-
Notifications
You must be signed in to change notification settings - Fork 0
/
shim.js
40 lines (40 loc) · 1.65 KB
/
shim.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
define(function () {
return {
AudioContext: window.AudioContext ||
window.webkitAudioContext,
requestAnimationFrame: function(render) {
var f = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame;
return f ? f.call(window, render) : function (callback) {
window.setTimeout(callback, 1000 / 24);
};
},
requestFullscreen: function() {
var requestFullscreen = this.requestFullscreen ||
this.webkitRequestFullScreen ||
this.mozRequestFullScreen ||
this.msRequestFullScreen;
requestFullscreen.call(this);
},
exitFullscreen: function() {
var exitFullscreen = document.exitFullscreen ||
document.webkitExitFullscreen ||
document.mozCancelFullScreen ||
document.msExitFullScreen;
exitFullscreen.call(document);
},
fullscreenElement: function() {
return document.FullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullScreenElement;
},
onfullscreenchange: function (callback, useCapture) {
document.addEventListener('fullscreenchange', callback, useCapture);
document.addEventListener('webkitfullscreenchange', callback, useCapture);
document.addEventListener('mozfullscreenchange', callback, useCapture);
document.addEventListener('msfullscreenchange', callback, useCapture);
}
};
});