Remove collection {insert,remove,set}_at callbacks
This commit is contained in:
@@ -157,9 +157,6 @@ ol.Collection.prototype.insertAt = function(index, elem) {
|
|||||||
ol.CollectionEventType.ADD, elem, undefined, undefined, this));
|
ol.CollectionEventType.ADD, elem, undefined, undefined, this));
|
||||||
this.dispatchEvent(new ol.CollectionEvent(
|
this.dispatchEvent(new ol.CollectionEvent(
|
||||||
ol.CollectionEventType.INSERT_AT, elem, index, undefined, this));
|
ol.CollectionEventType.INSERT_AT, elem, index, undefined, this));
|
||||||
if (this[ol.CollectionEventType.INSERT_AT]) {
|
|
||||||
this[ol.CollectionEventType.INSERT_AT](index);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -194,9 +191,6 @@ ol.Collection.prototype.removeAt = function(index) {
|
|||||||
ol.CollectionEventType.REMOVE, prev, undefined, undefined, this));
|
ol.CollectionEventType.REMOVE, prev, undefined, undefined, this));
|
||||||
this.dispatchEvent(new ol.CollectionEvent(ol.CollectionEventType.REMOVE_AT,
|
this.dispatchEvent(new ol.CollectionEvent(ol.CollectionEventType.REMOVE_AT,
|
||||||
undefined, index, prev, this));
|
undefined, index, prev, this));
|
||||||
if (this[ol.CollectionEventType.REMOVE_AT]) {
|
|
||||||
this[ol.CollectionEventType.REMOVE_AT](index);
|
|
||||||
}
|
|
||||||
return prev;
|
return prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -216,9 +210,6 @@ ol.Collection.prototype.setAt = function(index, elem) {
|
|||||||
prev, undefined, undefined, this));
|
prev, undefined, undefined, this));
|
||||||
this.dispatchEvent(new ol.CollectionEvent(ol.CollectionEventType.ADD,
|
this.dispatchEvent(new ol.CollectionEvent(ol.CollectionEventType.ADD,
|
||||||
elem, undefined, undefined, this));
|
elem, undefined, undefined, this));
|
||||||
if (this[ol.CollectionEventType.SET_AT]) {
|
|
||||||
this[ol.CollectionEventType.SET_AT](index, prev);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
var j;
|
var j;
|
||||||
for (j = n; j < index; ++j) {
|
for (j = n; j < index; ++j) {
|
||||||
|
|||||||
@@ -128,9 +128,9 @@ function testInsertAtEvent() {
|
|||||||
function testSetAtBeyondEnd() {
|
function testSetAtBeyondEnd() {
|
||||||
var collection = new ol.Collection();
|
var collection = new ol.Collection();
|
||||||
var inserts = [];
|
var inserts = [];
|
||||||
collection.insert_at = function(index) {
|
goog.events.listen(collection, ol.CollectionEventType.INSERT_AT, function(e) {
|
||||||
inserts.push(index);
|
inserts.push(e.index);
|
||||||
};
|
});
|
||||||
collection.setAt(2, 0);
|
collection.setAt(2, 0);
|
||||||
assertEquals(3, collection.getLength());
|
assertEquals(3, collection.getLength());
|
||||||
assertUndefined(collection.getAt(0));
|
assertUndefined(collection.getAt(0));
|
||||||
|
|||||||
Reference in New Issue
Block a user