@itwin/core-i18n 5.7.0-dev.13 → 5.7.0-dev.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21491,6 +21491,10 @@ class ObservableSet extends Set {
|
|
|
21491
21491
|
onDeleted = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21492
21492
|
/** Emitted after this set's contents are cleared. */
|
|
21493
21493
|
onCleared = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21494
|
+
/** Emitted after multiple items are added to this set via [[addAll]]. */
|
|
21495
|
+
onBatchAdded = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21496
|
+
/** Emitted after multiple items are deleted from this set via [[deleteAll]]. */
|
|
21497
|
+
onBatchDeleted = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
21494
21498
|
/** Construct a new ObservableSet.
|
|
21495
21499
|
* @param elements Optional elements with which to populate the new set.
|
|
21496
21500
|
*/
|
|
@@ -21523,6 +21527,32 @@ class ObservableSet extends Set {
|
|
|
21523
21527
|
this.onCleared.raiseEvent();
|
|
21524
21528
|
}
|
|
21525
21529
|
}
|
|
21530
|
+
/** Add multiple items to the set, raising [[onBatchAdded]] only once after all items are added.
|
|
21531
|
+
* This is more efficient than calling [[add]] in a loop when listeners need not be notified of each individual addition.
|
|
21532
|
+
* @param items The items to add.
|
|
21533
|
+
* @returns The number of items that were actually added (i.e., were not already present).
|
|
21534
|
+
*/
|
|
21535
|
+
addAll(items) {
|
|
21536
|
+
const prevSize = this.size;
|
|
21537
|
+
for (const item of items)
|
|
21538
|
+
super.add(item);
|
|
21539
|
+
if (this.size !== prevSize)
|
|
21540
|
+
this.onBatchAdded.raiseEvent();
|
|
21541
|
+
return this.size - prevSize;
|
|
21542
|
+
}
|
|
21543
|
+
/** Delete multiple items from the set, raising [[onBatchDeleted]] only once after all items are deleted.
|
|
21544
|
+
* This is more efficient than calling [[delete]] in a loop when listeners need not be notified of each individual deletion.
|
|
21545
|
+
* @param items The items to delete.
|
|
21546
|
+
* @returns The number of items that were actually deleted (i.e., were present in the set).
|
|
21547
|
+
*/
|
|
21548
|
+
deleteAll(items) {
|
|
21549
|
+
const prevSize = this.size;
|
|
21550
|
+
for (const item of items)
|
|
21551
|
+
super.delete(item);
|
|
21552
|
+
if (this.size !== prevSize)
|
|
21553
|
+
this.onBatchDeleted.raiseEvent();
|
|
21554
|
+
return prevSize - this.size;
|
|
21555
|
+
}
|
|
21526
21556
|
}
|
|
21527
21557
|
|
|
21528
21558
|
|
|
@@ -21631,11 +21661,15 @@ class OneAtATimeAction {
|
|
|
21631
21661
|
return await promise;
|
|
21632
21662
|
}
|
|
21633
21663
|
finally {
|
|
21634
|
-
//
|
|
21635
|
-
|
|
21636
|
-
this.
|
|
21637
|
-
|
|
21638
|
-
this._active.
|
|
21664
|
+
// A replaced pending request can be abandoned before it ever becomes active.
|
|
21665
|
+
// Only the currently active entry is allowed to promote/start the next pending request.
|
|
21666
|
+
if (this._active === entry) {
|
|
21667
|
+
// do all of this whether promise was fulfilled or rejected
|
|
21668
|
+
this._active = this._pending; // see if there's a pending request waiting
|
|
21669
|
+
this._pending = undefined; // clear pending
|
|
21670
|
+
if (this._active)
|
|
21671
|
+
this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
|
|
21672
|
+
}
|
|
21639
21673
|
}
|
|
21640
21674
|
}
|
|
21641
21675
|
}
|