Comparing version 2.0.4 to 3.0.0
14
index.js
@@ -7,3 +7,2 @@ var now = require('performance-now') | ||
, caf = global['cancel' + suffix] || global['cancelRequest' + suffix] | ||
, isNative = true | ||
@@ -18,4 +17,2 @@ for(var i = 0; i < vendors.length && !raf; i++) { | ||
if(!raf || !caf) { | ||
isNative = false | ||
var last = 0 | ||
@@ -69,12 +66,3 @@ , id = 0 | ||
// to the native rAF function | ||
if(!isNative) { | ||
return raf.call(global, fn) | ||
} | ||
return raf.call(global, function() { | ||
try{ | ||
fn.apply(this, arguments) | ||
} catch(e) { | ||
setTimeout(function() { throw e }, 0) | ||
} | ||
}) | ||
return raf.call(global, fn) | ||
} | ||
@@ -81,0 +69,0 @@ module.exports.cancel = function() { |
{ | ||
"name": "raf", | ||
"version": "2.0.4", | ||
"version": "3.0.0", | ||
"description": "requestAnimationFrame polyfill for node and the browser", | ||
@@ -26,3 +26,3 @@ "main": "index.js", | ||
"browserify": "~4.1.2", | ||
"tape": "~2.12.3" | ||
"tape": "^4.0.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "dependencies": { |
18
test.js
@@ -45,1 +45,19 @@ var test = require('tape') | ||
}) | ||
test('raf should throw on errors', function(t) { | ||
t.plan(1) | ||
var onError = function() { | ||
t.pass('error bubbled up to event loop') | ||
} | ||
if(typeof window !== 'undefined') { | ||
window.onerror = onError | ||
} else if(typeof process !== 'undefined') { | ||
process.on('uncaughtException', onError) | ||
} | ||
raf(function() { | ||
throw new Error('foo') | ||
}) | ||
}) |
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
18848
15
118