added a request animation frame polyfill
This commit is contained in:
parent
590b2708b6
commit
33303bbf62
@ -1,6 +1,9 @@
|
|||||||
class Gamepad {
|
class Gamepad {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.haveEvents = 'GamepadEvent' in window;
|
this.haveEvents = 'GamepadEvent' in window;
|
||||||
|
this.rAF = window.mozRequestAnimationFrame ||
|
||||||
|
window.webkitRequestAnimationFrame ||
|
||||||
|
window.requestAnimationFrame;
|
||||||
|
|
||||||
// cached DOM references
|
// cached DOM references
|
||||||
this.$gamepad = $('.gamepad');
|
this.$gamepad = $('.gamepad');
|
||||||
@ -288,7 +291,7 @@ class Gamepad {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// enqueue the next refresh right away
|
// enqueue the next refresh right away
|
||||||
requestAnimationFrame(this.updateVisualStatus.bind(this));
|
this.rAF(this.updateVisualStatus.bind(this));
|
||||||
|
|
||||||
// load latest gamepad data
|
// load latest gamepad data
|
||||||
this.refreshGamepads();
|
this.refreshGamepads();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user