Optionalparallel?: booleanWhether to dispose all the targets in parallel when the aggregator is disposed.
Defaults to false.
Adds a target to be disposed.
You can wrap the target with a WeakRef to prevent this class from holding a strong reference to the target.
Disposes all the targets that have been added and clears the list of targets.
After all the targets have been disposed, if any throws an error or rejects, then the error from the first such target will be thrown.
AsyncDisposeAggregatoris a utility class that allows you to add multiple items and then dispose them all at once. The items are disposed one by one in the order they were added. When theparalleloption is enabled, then all the items are disposed in parallel, triggered by the order in which they were added. You can add a function to call, an object with adisposemethod, an object with aSymbol.disposemethod, an object with aSymbol.asyncDisposemethod, or a Promise that resolves to one of the previous types. To dispose all the items, calldisposeor use theSymbol.asyncDisposesymbol. The difference betweenAsyncDisposeAggregatorandDisposeAggregatoris thatAsyncDisposeAggregatorcan dispose async targets.For example,