add missing insert and delete events to CircularList.splice

This commit is contained in:
Jörg Breitbart
2020-10-03 17:11:49 +02:00
parent e95f9815d8
commit faa60be6fb
2 changed files with 8 additions and 3 deletions
+4
View File
@@ -158,6 +158,7 @@ export class CircularList<T> implements ICircularList<T> {
this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];
}
this._length -= deleteCount;
this.onDeleteEmitter.fire({index: start, amount: deleteCount});
}
// Add items
@@ -167,6 +168,9 @@ export class CircularList<T> implements ICircularList<T> {
for (let i = 0; i < items.length; i++) {
this._array[this._getCyclicIndex(start + i)] = items[i];
}
if (items.length) {
this.onInsertEmitter.fire({index: start, amount: items.length});
}
// Adjust length as needed
if (this._length + items.length > this._maxLength) {