Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

5 Commits

Repository files navigation

timers

Timer management to clear large batches of timers.

Installation

$ component install component/timers

Example

In the following example the last two timers will not fire.

varTimers=require('timers');vartimers=newTimers;timers.timeout(function(){console.log('one');},1000);timers.timeout(function(){console.log('two');},2000);timers.timeout(function(){console.log('three');},3000);setTimeout(function(){timers.clear();},1500);

API

Timers()

Initialize a new timer set with optional ids.

Timers.timeout(fn:Function, ms:Number)

Add timeout fn.

Timers.interval(fn:Function, ms:Number)

Add interval fn.

Timers.clear()

Clear all timers.

License

MIT

About

Timer management (setInterval / setTimeout)

Resources

Stars

12 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages