ready-signal
A ready signal. Wait for ready and signal it's ready
Last updated 11 years ago by raynos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install ready-signal 
SYNC missed versions from official npm registry.

ready-signal

A ready signal. Wait for ready and signal it's ready

Example

var Ready = require("ready-signal")
var r1 = Ready()
var r2 = Ready()
var r3 = Ready()

r1(function onReady() {
    console.log("r1 ready")
})

setTimeout(r1.signal, 1000)

r2.signal()

r2(function onReady() {
    console.log("r2 is already ready")
})

r3(function ready(ev) {
    console.log("r3 has ev", ev)
})

r3.signal("event data")

Counted example

var CountedReady = require("ready-signal/counted")
var counted1 = CountedReady(3)
var counted2 = CountedReady(0)
var counted3 = CountedReady(1)

counted1(function () {
   console.log("called after 3 times")
})

counted1.signal()
counted1.signal()
console.log("before 3rd")
counted1.signal()
console.log("after 3rd")

counted2.signal()

counted2(function onReady() {
    console.log("r2 is already ready")
})

counted3(function ready(ev) {
    console.log("r3 has ev", ev)
})

counted3.signal("event data")

Installation

npm install ready-signal

Contributors

  • Raynos
  • jcorbin
  • davewhat

MIT Licenced

Current Tags

  • 1.3.0                                ...           latest (11 years ago)

11 Versions

  • 1.3.0                                ...           11 years ago
  • 1.2.0                                ...           12 years ago
  • 1.1.1                                ...           12 years ago
  • 1.1.0                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.5.0                                ...           12 years ago
  • 0.4.1                                ...           14 years ago
  • 0.4.0                                ...           14 years ago
  • 0.3.0                                ...           14 years ago
  • 0.2.0                                ...           14 years ago
  • 0.1.0                                ...           14 years ago
Maintainers (2)
Downloads
Total 43
Today 0
This Week 0
This Month 43
Last Day 0
Last Week 43
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE