Make ol.Collection#extend return this

This to be able to do this:

new ol.Map({
  controls: ol.control.defaults().extend([new MyControl()]),
  ...
})
This commit is contained in:
Éric Lemoine
2013-08-19 14:13:52 +02:00
parent 77adbdfa7a
commit 6576a49178

View File

@@ -86,12 +86,14 @@ ol.Collection.prototype.clear = function() {
/**
* @param {Array} arr Array.
* @return {ol.Collection} This collection.
*/
ol.Collection.prototype.extend = function(arr) {
var i, ii;
for (i = 0, ii = arr.length; i < ii; ++i) {
this.push(arr[i]);
}
return this;
};