0.0.0 • Published 8 years ago
event-within v0.0.0
event-within
Register event handlers for a certain time frame.
Get it!
npm install --save event-withinUsage
node usage and type sth:
var withinify = require('event-within')
var stdwithin = withinify(process.stdin)
stdwithin.onwithin('data', Date.now() + 15000, function (chunk) {
console.log('within::', chunk.toString())
})API
emitter = withinify(emitter)
Add two custom event registration functions on your emitter.
emitter.onwithin(event[, start], end, handler)
Register an event handler for a certain time. start and end must be timestamps. start is optional and defaults to Date.now().
emitter.oncewithin(event[, start], end, handler)
Register an one-time event handler for a certain time. start and end must be timestamps. start is optional and defaults to Date.now().
License
0.0.0
8 years ago