request-animation-frame
Advanced tools
Comparing version 0.1.0 to 0.1.1
(function() { | ||
var _ref; | ||
var max, now, _ref, _ref2; | ||
_ref = (function() { | ||
var cancel, isNative, last, request, vendor, _i, _len, _ref; | ||
now = (_ref = Date.now) != null ? _ref : function() { | ||
return new Date().getTime(); | ||
}; | ||
max = Math.max; | ||
_ref2 = (function() { | ||
var cancel, isNative, last, request, vendor, _i, _len, _ref2; | ||
last = 0; | ||
request = typeof window !== "undefined" && window !== null ? window.requestAnimationFrame : void 0; | ||
cancel = typeof window !== "undefined" && window !== null ? window.cancelAnimationFrame : void 0; | ||
_ref = ["webkit", "moz", "o", "ms"]; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
vendor = _ref[_i]; | ||
_ref2 = ["webkit", "moz", "o", "ms"]; | ||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
vendor = _ref2[_i]; | ||
if (cancel == null) { | ||
@@ -23,4 +29,4 @@ cancel = (typeof window !== "undefined" && window !== null ? window["" + vendor + "cancelAnimationFrame"] : void 0) || (typeof window !== "undefined" && window !== null ? window["" + vendor + "cancelRequestAnimationFrame"] : void 0); | ||
if (timeout == null) timeout = 16; | ||
cur = new Date().getTime(); | ||
time = Math.max(0, timeout + last - cur); | ||
cur = now(); | ||
time = max(0, timeout + last - cur); | ||
id = setTimeout(function() { | ||
@@ -39,4 +45,4 @@ return typeof callback === "function" ? callback(cur + time) : void 0; | ||
return [request, cancel]; | ||
})(), this.requestAnimationFrame = _ref[0], this.cancelAnimationFrame = _ref[1]; | ||
})(), this.requestAnimationFrame = _ref2[0], this.cancelAnimationFrame = _ref2[1]; | ||
}).call(this); |
{ "name": "request-animation-frame" | ||
, "description": "requestAnimationFrame shim" | ||
, "version": "0.1.0" | ||
, "version": "0.1.1" | ||
, "homepage": "https://github.com/dodo/requestAnimationFrame.js" | ||
@@ -5,0 +5,0 @@ , "author": "dodo (https://github.com/dodo)" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2413
43