Files
Panayot Cankov 05cd636fc8 npm scripts for typechecking public .d.ts-es and running tslint (#2934)
* npm scripts for typechecking public .d.ts-es and running tslint

* Update test.ts
2016-10-27 15:18:54 +03:00
..
2016-05-26 14:30:25 +03:00
2016-05-26 14:30:25 +03:00

Timer module. Functions also can be availble in the global context if you require globals module.

    require("globals");

	setTimeout(function(){ log("Test"); }, 2000);

	var id = setTimeout(function(){ log("Test"); }, 2000);
	...
	clearTimeout(id);

	setInterval(function(){ log("Test"); }, 2000);

	var intervalId = setInterval(function(){ log("Test"); }, 2000);
	...
	clearInterval(intervalId)

OR

    var timer = require("timer");

	timer.setTimeout(function(){ log("Test"); }, 2000);

	var id = timer.setTimeout(function(){ log("Test"); }, 2000);
	...
	timer.clearTimeout(id);

	timer.setInterval(function(){ log("Test"); }, 2000);

	var intervalId = timer.setInterval(function(){ log("Test"); }, 2000);
	...
	timer.clearInterval(intervalId)

The second parameter for setTimeout and setInterval is optional with default value of 0.