Timer

Control time like a boss.



__.timer.set( name: string, callback: function )

This method generates a unique instance to control the clock. You just need to set choose a name. Besides that, you can also defines a callback function, that will be called everytime the clock ticks.

__.timer.set('bigBen', myFunction);

__.timer.{name}.start( time: integer, unit: string )

Replace {name} with the name you chose on __.timer.set(). This method starts the clock. You can literally pass how long it will take for you callback function to be called. Like, in 3, seconds, or using a shorthand, in 3, s.

__.timer.bigBen.start(3, 's');

__.timer.{name}.stop()

Replace {name} with the name you chose on __.timer.set(). This method stops the clock.

__.timer.bigBen.stop();

__.timer.{name}.tick( callback: function )

Replace {name} with the name you chose on __.timer.set(). This method replaces (if already defined) or defines a new callback method to be called everytime the clock ticks.

__.timer.bigBen.tick(newFunction);

Based on Timer module from our previous library.