|
3 | 3 | * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} |
4 | 4 | */ |
5 | 5 |
|
6 | | -// ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc |
7 | | -if (!Math.trunc) { |
8 | | - Math.trunc = function trunc(x) { |
9 | | - return x < 0 ? Math.ceil(x) : Math.floor(x); |
10 | | - }; |
11 | | -} |
12 | | - |
13 | 6 | /** |
14 | 7 | * A polyfill for Function.prototype.bind |
15 | 8 | */ |
@@ -52,133 +45,3 @@ if (!Function.prototype.bind) { |
52 | 45 | })(); |
53 | 46 | } |
54 | 47 |
|
55 | | -/** |
56 | | -* A polyfill for Array.isArray |
57 | | -*/ |
58 | | -if (!Array.isArray) |
59 | | -{ |
60 | | - Array.isArray = function (arg) |
61 | | - { |
62 | | - return Object.prototype.toString.call(arg) === '[object Array]'; |
63 | | - }; |
64 | | -} |
65 | | - |
66 | | -/** |
67 | | -* A polyfill for Array.forEach |
68 | | -* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach |
69 | | -*/ |
70 | | -if (!Array.prototype.forEach) |
71 | | -{ |
72 | | - Array.prototype.forEach = function(fun /*, thisArg */) |
73 | | - { |
74 | | - "use strict"; |
75 | | - |
76 | | - if (this === void 0 || this === null) |
77 | | - { |
78 | | - throw new TypeError(); |
79 | | - } |
80 | | - |
81 | | - var t = Object(this); |
82 | | - var len = t.length >>> 0; |
83 | | - |
84 | | - if (typeof fun !== "function") |
85 | | - { |
86 | | - throw new TypeError(); |
87 | | - } |
88 | | - |
89 | | - var thisArg = arguments.length >= 2 ? arguments[1] : void 0; |
90 | | - |
91 | | - for (var i = 0; i < len; i++) |
92 | | - { |
93 | | - if (i in t) |
94 | | - { |
95 | | - fun.call(thisArg, t[i], i, t); |
96 | | - } |
97 | | - } |
98 | | - }; |
99 | | -} |
100 | | - |
101 | | -/** |
102 | | -* Low-budget Float32Array knock-off, suitable for use with P2.js in IE9 |
103 | | -* Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/ |
104 | | -* Cameron Foale (http://www.kibibu.com) |
105 | | -*/ |
106 | | -if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object") |
107 | | -{ |
108 | | - var CheapArray = function(type) |
109 | | - { |
110 | | - var proto = new Array(); // jshint ignore:line |
111 | | - |
112 | | - window[type] = function(arg) { |
113 | | - |
114 | | - if (typeof(arg) === "number") |
115 | | - { |
116 | | - Array.call(this, arg); |
117 | | - this.length = arg; |
118 | | - |
119 | | - for (var i = 0; i < this.length; i++) |
120 | | - { |
121 | | - this[i] = 0; |
122 | | - } |
123 | | - } |
124 | | - else |
125 | | - { |
126 | | - Array.call(this, arg.length); |
127 | | - |
128 | | - this.length = arg.length; |
129 | | - |
130 | | - for (var i = 0; i < this.length; i++) |
131 | | - { |
132 | | - this[i] = arg[i]; |
133 | | - } |
134 | | - } |
135 | | - }; |
136 | | - |
137 | | - window[type].prototype = proto; |
138 | | - window[type].constructor = window[type]; |
139 | | - }; |
140 | | - |
141 | | - CheapArray('Float32Array'); // jshint ignore:line |
142 | | - CheapArray('Uint32Array'); // jshint ignore:line |
143 | | - CheapArray('Uint16Array'); // jshint ignore:line |
144 | | - CheapArray('Int16Array'); // jshint ignore:line |
145 | | - CheapArray('ArrayBuffer'); // jshint ignore:line |
146 | | -} |
147 | | - |
148 | | -/** |
149 | | - * Also fix for the absent console in IE9 |
150 | | - */ |
151 | | -if (!window.console) |
152 | | -{ |
153 | | - window.console = {}; |
154 | | - window.console.log = window.console.assert = function(){}; |
155 | | - window.console.warn = window.console.assert = function(){}; |
156 | | -} |
157 | | - |
158 | | -/** |
159 | | - * performance.now |
160 | | - */ |
161 | | -(function(){ |
162 | | - |
163 | | - if ("performance" in window == false) { |
164 | | - window.performance = {}; |
165 | | - } |
166 | | - |
167 | | - Date.now = (Date.now || function () { // thanks IE8 |
168 | | - return new Date().getTime(); |
169 | | - }); |
170 | | - |
171 | | - if ("now" in window.performance == false) |
172 | | - { |
173 | | - var nowOffset = Date.now(); |
174 | | - |
175 | | - if (performance.timing && performance.timing.navigationStart){ |
176 | | - nowOffset = performance.timing.navigationStart |
177 | | - } |
178 | | - |
179 | | - window.performance.now = function now(){ |
180 | | - return Date.now() - nowOffset; |
181 | | - } |
182 | | - } |
183 | | - |
184 | | -})(); |
0 commit comments