Skip to content

Commit

Permalink
Polyfill cancelAnimationFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed May 19, 2018
1 parent 9ccab3a commit e81c32a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ CSS.paintWorklet.addModule('./ripple-worklet.js');

if (!window.performance) window.performance = { now: Date.now.bind(Date) };

if (!window.requestAnimationFrame) window.requestAnimationFrame = function(cb) { return setTimeout(doAnim, 16, cb); };
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = function(cb) { return setTimeout(doAnim, 16, cb); };
window.cancelAnimationFrame = function(req) { clearTimeout(req); }
}
function doAnim(cb) { cb(performance.now()); }

function ripple(button, evt) {
Expand Down

0 comments on commit e81c32a

Please sign in to comment.