setTimeout
and setInterval
with unref
and ref
like in node.js
Please only use this in the browser, not in node.
install
npm install timers-ref
usage
var timers = timers timers var timeout = timerstimers var interval = timerstimers
If you want to listen to process.on('exit')
to know when there are no setTimeout
or setInterval
timers in the event queue, do this:
timers process
Note one important difference: This won't emit process.on('exit') if no setTimeouts or setIntervals are called. Needs at least one call to get things going.
license
MIT. Copyright (c) Feross Aboukhadijeh.