Remove goog.array.remove

This commit is contained in:
Nicholas L
2016-01-17 16:35:26 +13:00
parent d1b6a17773
commit d743ada8fd
3 changed files with 19 additions and 4 deletions
+15
View File
@@ -158,3 +158,18 @@ ol.array.extend = function(arr, data) {
arr[arr.length] = extension[i]; arr[arr.length] = extension[i];
} }
} }
/**
* @param {Array<VALUE>} arr The array to modify.
* @param {VALUE} obj The element to remove.
* @template VALUE
* @return {boolean} If the element was removed.
*/
ol.array.remove = function(arr, obj) {
var i = arr.indexOf(obj);
if (i > -1) {
arr.splice(i, 1);
}
return i > -1;
}
+2 -2
View File
@@ -5,7 +5,6 @@
goog.provide('ol.Map'); goog.provide('ol.Map');
goog.provide('ol.MapProperty'); goog.provide('ol.MapProperty');
goog.require('goog.array');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.async.AnimationDelay'); goog.require('goog.async.AnimationDelay');
goog.require('goog.async.nextTick'); goog.require('goog.async.nextTick');
@@ -45,6 +44,7 @@ goog.require('ol.Size');
goog.require('ol.TileQueue'); goog.require('ol.TileQueue');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.array');
goog.require('ol.control'); goog.require('ol.control');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.has'); goog.require('ol.has');
@@ -574,7 +574,7 @@ ol.Map.prototype.beforeRender = function(var_args) {
* @return {boolean} Whether the preRenderFunction has been found and removed. * @return {boolean} Whether the preRenderFunction has been found and removed.
*/ */
ol.Map.prototype.removePreRenderFunction = function(preRenderFunction) { ol.Map.prototype.removePreRenderFunction = function(preRenderFunction) {
return goog.array.remove(this.preRenderFunctions_, preRenderFunction); return ol.array.remove(this.preRenderFunctions_, preRenderFunction);
}; };
+2 -2
View File
@@ -30,11 +30,11 @@
goog.provide('ol.pointer.TouchSource'); goog.provide('ol.pointer.TouchSource');
goog.require('goog.array');
goog.require('goog.object'); goog.require('goog.object');
goog.require('ol'); goog.require('ol');
goog.require('ol.pointer.EventSource'); goog.require('ol.pointer.EventSource');
goog.require('ol.pointer.MouseSource'); goog.require('ol.pointer.MouseSource');
goog.require('ol.array');
/** /**
@@ -443,7 +443,7 @@ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) {
goog.global.setTimeout(function() { goog.global.setTimeout(function() {
// remove touch after timeout // remove touch after timeout
goog.array.remove(lts, lt); ol.array.remove(lts, lt);
}, ol.pointer.TouchSource.DEDUP_TIMEOUT); }, ol.pointer.TouchSource.DEDUP_TIMEOUT);
} }
}; };