Skip to content

Wait for a nanoresource to be ready (opened) and call a callback.

License

Notifications You must be signed in to change notification settings

little-core-labs/nanoresource-ready

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nanoresource-ready

Wait for a nanoresource to be ready (opened) and call a callback.

Installation

$ npm install nanoresource-ready

Status

Stable

Usage

const ready = require('nanoresource-ready')

// will call `resource.open()` if not already "opening"
ready(resource, (err) => {
})

// fast ready (possibly synchronous) if `true === resource.opening`
ready(resource, { opening: true }, (err) => {
})

API

ready(resource[, opts], callback)

Waits for a nanoresource to be ready (opened) and calls callback(err). opts can be an object that can look like:

{
  opening: false // if `true`, will call callback synchronously if resource is "opening"
}

ready.mixin(resource)

Mixes in a ready() method to nanoresource instance object.

resource = ready.mixin(resource)

License

MIT

About

Wait for a nanoresource to be ready (opened) and call a callback.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published