• Stars
    star
    282
  • Rank 141,039 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 11 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Basically setTimeout with more options.

jQuery Timer

Build Status

Basically setTimeout with more options.

View demo: http://jchavannes.com/jquery-timer/demo

Download: http://jchavannes.com/download/jquery-timer-demo.zip


$.timer()

$.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.


Usage

var timer = $.timer(function() {
    alert('This message was sent by a timer.');
});
timer.set({ time : 5000, autostart : true });
timer.set(options);
timer.play(reset);  // Boolean. Defaults to false.
timer.pause();
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

License

See the LICENSE file for license rights and limitations (MIT).