npm

Need private packages and team management tools?Check out npm Orgs. »

callback-store

1.0.0 • Public • Published

callback-store

A store for callbacks waiting for delayed response.

Dependency Status Build Status npm version Coverage Status

Installation

npm install --save callback-store

Usage

const cbStore = require('callback-store')
 
let callbacks = cbStore()
let uid = Math.random()
callbacks.add(uid, function(err) {
  if (err) {
    /* An error will happen if the callback isn't executed during 5 seconds */
    return
  }
  console.log('Hello world!')
}, 5000)
 
/* ... */
 
let cb = callbacks.get(uid)
cb()

License

The MIT License (MIT)

Keywords

install

npm i callback-store

Downloadsweekly downloads

32

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability