aldeed:clock
An accurate reactive clock package for Meteor. Retains elapsed time and keeps ticking across hot code reloads.
Installation
In your Meteor app directory, enter:
$ meteor add aldeed:clock
Usage
1var ExerciseClock = new ReactiveClock("ExerciseClock"); 2ExerciseClock.start(); 3ExerciseClock.stop(); 4ExerciseClock.setElapsedSeconds(30); 5 6// reactive 7var elapsedSeconds = ExerciseClock.elapsedTime(); 8 9// reactive; requires momentjs library 10var elapsedTimeHumanized = ExerciseClock.elapsedTime({humanize: true, suffix: true}); 11 12// reactive; requires numeraljs library 13var elapsedSeconds = ExerciseClock.elapsedTime({format: '00:00:00'});
The elapsedTime
function causes your computation to rerun on every 1-second tick.
Contributing
Code contributions and fixes welcome by pull request.