NativeScript/timer at master · alvsgithub/NativeScript
Repository navigation
timer
Directory actions
More options
Directory actions
More options
Latest commit
History
History
View commit history for this file.
timer
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
parent directory.. | |||
| Readme.md | Readme.md | ||
| package.json | package.json | ||
| timer.android.ts | timer.android.ts | ||
| timer.d.ts | timer.d.ts | ||
| timer.ios.ts | timer.ios.ts | ||
Readme.md
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.