0.1.1 • Published 8 years ago
each-timer v0.1.1
each-timer
Elegant timer interface
Getting Started
Install it via npm:
npm install each-timer
Include in your project:
var each-timer = require("each-timer");
Functions
isFunction(param) ⇒ Boolean
Check if passed param is function
Kind: global function
Param | Type | Description |
---|---|---|
param | Any | Any variable to check |
Timer(timingFn)
Timer constructor
Kind: global function
Param | Type | Description |
---|---|---|
timingFn | function | Function that get passsed time interval and return it as milliseconds |
timer.perform(Callback) ⇒ Timer
Set callback function for executing by timer
Kind: instance method of Timer Returns: Timer - Object itself
Param | Type | Description |
---|---|---|
Callback | function | function. If it returns false execution of timer will be canceled. @see restart |
timer.stop() ⇒ Timer
Stop timer execution
Kind: instance method of Timer Returns: Timer - Object itself
timer.restart() ⇒ Timer
Restart timer execution flow
Kind: instance method of Timer Returns: Timer - Object itself
each(interval) ⇒ Object
Return timer constructors for specified interval
Kind: global function Returns: Object - Object with factory functions for interval units (milliseconds, seconds, minutes and hours)
Param | Type | Description |
---|---|---|
interval | Integer | Time interval for timer |
License
0.1.1
8 years ago