Frame.js icon indicating copy to clipboard operation
Frame.js copied to clipboard

Neat Timers

Open bishopZ opened this issue 11 years ago • 0 comments

https://github.com/doconix/jquery.powertimer.js

A jQuery plugin that provides the following types of timers:

  1. A single-run timer (a.k.a. setTimeout)

  2. A repeated-run timer (a.k.a. setInterval)

  3. A repeated-run timer that runs immediately, then waits the interval.

  4. A repeated-run, definite interval timer (see sleep option below).

  5. A repeated-run, definite interval timer that runs immediately, then waits the sleep time.

    Why would you use this library vs. the regular setTimeout? Because it provides lots of additional features! For example:

    • Automatic timer id tracking.
  6. Pausing and later continuing of timers.

  7. Unique timers, meaning if you start a timer twice, the first one is automatically cleared.

  8. Automatic stopping of timer after a specified number of millis.

  9. Automatic timer removal when related elements are removed from the DOM.

  10. Multiple, named timers per element.

  11. The "this" variable is available in your timed function.

  12. Simply return false from a timer function to cancel the timer.

  13. A JQuery-like interface for more clear code.

  14. Allows parameter passing in both all browsers, including IE which normally doesn't pass parameters nicely

  15. Returning of timer options, which provides access to the timer function, etc.

bishopZ avatar Apr 22 '14 19:04 bishopZ