sqginfo/jquery-timer

There is no license information available for the latest version (dev-master) of this package.

Installs: 598

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 76

Language:JavaScript

dev-master 2017-04-11 15:10 UTC

This package is auto-updated.

Last update: 2024-11-11 00:11:42 UTC


README

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