removes opt_this from ol.Collection#forEach

this commit also removes all uses of the standard thisArg of
Array#forEach.
This commit is contained in:
simonseyock
2017-12-16 13:43:46 +01:00
parent 1aa7313a7b
commit 3e82c37bed
13 changed files with 28 additions and 36 deletions

View File

@@ -101,18 +101,15 @@ _ol_Collection_.prototype.extend = function(arr) {
/**
* Iterate over each element, calling the provided callback.
* @param {function(this: S, T, number, Array.<T>): *} f The function to call
* @param {function(T, number, Array.<T>): *} f The function to call
* for every element. This function takes 3 arguments (the element, the
* index and the array). The return value is ignored.
* @param {S=} opt_this The object to use as `this` in `f`.
* @template S
* @api
*/
_ol_Collection_.prototype.forEach = function(f, opt_this) {
var fn = (opt_this) ? f.bind(opt_this) : f;
_ol_Collection_.prototype.forEach = function(f) {
var array = this.array_;
for (var i = 0, ii = array.length; i < ii; ++i) {
fn(array[i], i, array);
f(array[i], i, array);
}
};