Use goog.array.extend instead of ol.array.safeExtend

The upstream implementation now supports large arrays.
See https://github.com/google/closure-library/pull/356
This commit is contained in:
Frederic Junod
2014-11-17 11:49:05 +01:00
parent 443c9749fb
commit f8b59dbd53
9 changed files with 18 additions and 39 deletions

View File

@@ -37,25 +37,6 @@ ol.array.binaryFindNearest = function(arr, target) {
};
/**
* Safe version of goog.array.extend that does not risk to overflow the stack
* even if `array2` contains a large number of elements.
*
* @param {Array.<T>} array1 Array 1.
* @param {Array.<T>} array2 Array 2.
* @template T
*/
ol.array.safeExtend = function(array1, array2) {
// goog.array.extend uses Array.prototype.push.apply, which can overflow the
// stack if array2 contains too many elements. Repeatedly calling push
// performs as well on modern browsers.
var i, ii;
for (i = 0, ii = array2.length; i < ii; ++i) {
array1.push(array2[i]);
}
};
/**
* @param {Array.<number>} arr Array.
* @param {number} target Target.