Merge pull request #6220 from fredj/collection_push_length

Fix ol.Collection#push return value
This commit is contained in:
Frédéric Junod
2016-12-08 08:26:31 +01:00
committed by GitHub
2 changed files with 19 additions and 7 deletions

View File

@@ -145,13 +145,13 @@ ol.Collection.prototype.pop = function() {
/**
* Insert the provided element at the end of the collection.
* @param {T} elem Element.
* @return {number} Length.
* @return {number} New length of the collection.
* @api stable
*/
ol.Collection.prototype.push = function(elem) {
var n = this.array_.length;
var n = this.getLength();
this.insertAt(n, elem);
return n;
return this.getLength();
};