0.1.1 • Published 8 years ago

each-timer v0.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

each-timer

Build Status Coverage Downloads npm version dependencies dev dependencies License

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

ParamTypeDescription
paramAnyAny variable to check

Timer(timingFn)

Timer constructor

Kind: global function

ParamTypeDescription
timingFnfunctionFunction 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

ParamTypeDescription
Callbackfunctionfunction. 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)

ParamTypeDescription
intervalIntegerTime interval for timer

License

MIT