fix requestAnimationFrame so listen() works

This commit is contained in:
Jeff Nusz 2016-08-17 16:17:09 -07:00
parent e129e08b9d
commit 55e97171cc
2 changed files with 5 additions and 8 deletions

View File

@ -1211,7 +1211,7 @@ function setPresetSelectIndex(gui) {
function updateDisplays(controllerArray) {
if (controllerArray.length !== 0) {
requestAnimationFrame(function() {
requestAnimationFrame.call(window, function() {
updateDisplays(controllerArray);
});
}

View File

@ -11,16 +11,13 @@
* http://www.apache.org/licenses/LICENSE-2.0
*/
export default function() {
function requestAnimationFrame(callback) {
// TODO: Get rid of window
window.setTimeout(callback, 1000 / 60);
setTimeout(callback, 1000 / 60);
}
return window.requestAnimationFrame ||
export default window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
requestAnimationFrame;
}