Basically setTimeout with more options.
JavaScript HTML CSS
Latest commit 4d73d07 Mar 5, 2016 @jchavannes Merge pull request #12 from jchavannes/update
Cleaning up code with proper functions, formatting and annotations

jQuery Timer

Build Status

Basically setTimeout with more options.

View demo:



$.timer( [ action ] , [ time ], [ autostart ] )

  • action A Function to be called by the timer.

  • time A Number determining how long between actions in milliseconds.

  • autostart A Boolean indicating whether to start the timer. Defaults to false.


var timer = $.timer(function() {
    alert('This message was sent by a timer.');
timer.set({ time : 5000, autostart : true });
timer.set(options);;  // Boolean. Defaults to false.
timer.stop();  // Pause and resets
timer.toggle(reset);  // Boolean. Defaults to false.
timer.once(time);  // Number. Defaults to 0.
timer.isActive  // Returns true if timer is running
timer.remaining // Remaining time when paused