Register event handlers for a certain time frame.
npm install --save event-within
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())
})
Add two custom event registration functions on your emitter.
Register an event handler for a certain time. start
and end
must be timestamps. start
is optional and defaults to Date.now()
.
Register an one-time event handler for a certain time. start
and end
must be timestamps. start
is optional and defaults to Date.now()
.