1.0.0 • Published 8 years ago
observ-focus v1.0.0
observ-focus
Observable interface to window focus/blur state
Install
$ npm install --save observ-focus
Usage
var focus = require('observ-focus')
focus()
//=> true/false
focus(function onFocus (focused) {
//=> true/false
})
API
focus([callback])
-> boolean
/ function
Returns the current focus state when the callback
is omitted. If a callback is provided, an unlisten
function is returned.
callback
Required
Type: callback
A callback called with the window
's focus state whenever it changes.
License
MIT © Ben Drucker
1.0.0
8 years ago