PageSourceSearch

https://jim-wolf-i-am.github.io/spiro-4-hsl-2/raf-polyfill.js

js jim-wolf-i-am.github.io collected 2026-10-03 09:23:34 UTC 1,260 bytes, 31 lines download raw bytes

vendor: 1,260 bytes, lines 1-31
1// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
2// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
3 
4// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
5 
6// MIT license
7 
8(function() {
9    var lastTime = 0;
10    var vendors = ['ms', 'moz', 'webkit', 'o'];
11    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
12        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
13        window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] 
14                                   || window[vendors[x]+'CancelRequestAnimationFrame'];
15    }
16 
17    if (!window.requestAnimationFrame)
18        window.requestAnimationFrame = function(callback, element) {
19            var currTime = new Date().getTime();
20            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
21            var id = window.setTimeout(function() { callback(currTime + timeToCall); }, 
22              timeToCall);
23            lastTime = currTime + timeToCall;
24            return id;
25        };
26 
27    if (!window.cancelAnimationFrame)
28        window.cancelAnimationFrame = function(id) {
29            clearTimeout(id);
30        };
31}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.