1.0.0 • Published 8 years ago

callback-store v1.0.0

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

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)

1.0.0

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago