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, then the error from the first such target will be thrown.
DisposeAggregatoris a utility class that allows you to add multiple items and then dispose them all at once. You can add a function to call, an object with adisposemethod, or an object with aSymbol.disposemethod. To dispose all the items, calldisposeor use theSymbol.disposesymbol.For example,