Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zewa666/jquery-setinterval
jQuery setInterval implementation using requestAnimFrame
https://github.com/zewa666/jquery-setinterval
Last synced: about 12 hours ago
JSON representation
jQuery setInterval implementation using requestAnimFrame
- Host: GitHub
- URL: https://github.com/zewa666/jquery-setinterval
- Owner: zewa666
- Created: 2013-02-21T19:58:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-02-21T20:00:53.000Z (over 11 years ago)
- Last Synced: 2023-04-06T14:20:36.777Z (over 1 year ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jQuery setInterval
=======================jQuery setInterval is an implementation of setInterval using requestAnimFrame to render Frame based animations.
Moreover this implementation includes as well an optional breakCondition, which is implemented as passed callback and a
stopNotification, which gets triggered if the breakCondition returns true.Besides the frame based animation, another feature is that requestAnimFrame will also stop rendering as soon as the Browser tab has
been switched.
See Paul Irish' great article about it [here](http://paulirish.com/2011/requestanimationframe-for-smart-animating/).Usage
-----$.setInterval(callback_for_action, interval, callback_for_break_condition, callback_for_stop_notification );
Inspect the projects index.html file to see an example setup.
Note: To verify the pause while not active simply open another page in parallel and switch to the other tab
while the counting is in progress, then switch back to.```js
// Initialize setInterval
$.setInterval(function(){
// DO YOUR MAGIC HERE ...
}, 500, function() {
return ("SOME CONDITION") ? true : false;
}, function() {
// DO STUFF HERE WHEN INTERVAL HAS STOPPED
});
```