Skip to content

Commit 45985b5

Browse files
Polyfill cancelAnimationFrame
1 parent e6e40ba commit 45985b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

demo/demo.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ CSS.paintWorklet.addModule('./ripple-worklet.js');
2828

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

31-
if (!window.requestAnimationFrame) window.requestAnimationFrame = function(cb) { return setTimeout(doAnim, 16, cb); };
31+
if (!window.requestAnimationFrame) {
32+
window.requestAnimationFrame = function(cb) { return setTimeout(doAnim, 16, cb); };
33+
window.cancelAnimationFrame = function(req) { clearTimeout(req); }
34+
}
3235
function doAnim(cb) { cb(performance.now()); }
3336

3437
function ripple(button, evt) {

0 commit comments

Comments
 (0)