SkillAgentSearch skills...

Timers

Timer management (setInterval / setTimeout)

Install / Use

/learn @component/Timers
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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.

var Timers = require('timers');
var timers = new Timers;

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

View on GitHub
GitHub Stars12
CategoryDevelopment
Updated8y ago
Forks3

Languages

JavaScript

Security Score

60/100

Audited on May 29, 2017

No findings