1.0.4 • Published 9 years ago

readydevice v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

readydevice

Avoid coordinated bootstrap sequences or singleton pseudo-global devices.

Usage

It is not particularly pretty, but it works and does not bleed complexity.

var readydevice = require('readydevice')

var getSomething = readydevice((ready) => {
  someAsyncSetup(function(something){
    ready(something)
  })
})

//...later

getSomething(function(something){
  //If the device is already `ready` it will immediately fire the callback.
  //Otherwise the callback will be queued and invoked once the device is ready.
})