From 6045711be9b27dce86f51c84a91f773454d77319 Mon Sep 17 00:00:00 2001 From: Tobias Goulden Schultz Date: Tue, 4 Sep 2018 12:52:00 +0200 Subject: [PATCH] Use browser variants of requestAnimationFrame I assume that IE<= 11 doesn't recognize window.requestAnimationFrame in _some_ cases. My program haults at `_requestAnimationFrame()` and says that the Object is undefined. This change adds support for all browsers and fixes that bug. --- src/structure.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/structure.js b/src/structure.js index a165c6c..c74c56c 100644 --- a/src/structure.js +++ b/src/structure.js @@ -589,8 +589,13 @@ function handleHistory (emitter, fn) { }; } -var _requestAnimationFrame = (typeof window !== 'undefined' && - window.requestAnimationFrame) || utils.raf; +var _requestAnimationFrame = ( + typeof window !== 'undefined' && ( + window.requestAnimationFrame.bind(window) + || window.webkitRequestAnimationFrame.bind(window) + || window.webkitRequestAnimationFrame.bind(window) + || window.mozRequestAnimationFrame.bind(window) + || window.mozRequestAnimationFrame.bind(window)) || utils.raf) // Update history if history is active function possiblyEmitAnimationFrameEvent (emitter, newStructure, oldData, keyPath) {