mirror of
https://github.com/wassname/phaser.git
synced 2026-06-30 16:40:20 +08:00
34 lines
771 B
JavaScript
34 lines
771 B
JavaScript
module.exports = Utils;
|
|
|
|
/**
|
|
* Misc utility functions
|
|
* @class Utils
|
|
* @constructor
|
|
*/
|
|
function Utils(){};
|
|
|
|
/**
|
|
* Append the values in array b to the array a. See <a href="http://stackoverflow.com/questions/1374126/how-to-append-an-array-to-an-existing-javascript-array/1374131#1374131">this</a> for an explanation.
|
|
* @method appendArray
|
|
* @static
|
|
* @param {Array} a
|
|
* @param {Array} b
|
|
*/
|
|
Utils.appendArray = function(a,b){
|
|
if (b.length < 150000) {
|
|
a.push.apply(a, b)
|
|
} else {
|
|
for (var i = 0, len = b.length; i !== len; ++i) {
|
|
a.push(b[i]);
|
|
}
|
|
}
|
|
};
|
|
|
|
/**
|
|
* The array type to use for internal numeric computations.
|
|
* @type {Array}
|
|
* @static
|
|
* @property ARRAY_TYPE
|
|
*/
|
|
Utils.ARRAY_TYPE = Float32Array || Array;
|