1.0.0 • Published 8 years ago

observ-focus v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

observ-focus Build Status

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