tic
intervals and timeouts using a delta tick. Useful for timing things with games.
example
var tic = ; var clearInterval = tic; var clearTimeout = tic; game;
api
require('tic')()
Returns an instance of a Tic timer.
tic.interval(fn, time, [param1, param2, ...])
Runs the function fn
at the given time
interval.
tic.timeout(fn, time, [param1, param2, ...])
Runs the function fn
only once at the given time
.
tic.tick([delta])
Use to advance the timer.
install
With npm do:
npm install tic
release history
- 1.0.0 - delta optional in tick
- 0.2.1 - fix bug with clearing timer
- 0.2.0 - now returns an instance of Tic for multiple timers
- 0.1.0 - initial release
license
Copyright (c) 2014 Kyle Robinson Young Licensed under the MIT license.