A Disposable Store is an IDisposable that manages Disposers and IDisposables.
All Disposers and IDisposables in the store will be invoked(flush
) when the store is disposed.
A DisposableStore is also a Disposer, which means it can be the dispose
method of an IDisposable.
A DisposableStore is also an IDisposable, which means it can be managed by another DisposableStore.
Add a DisposableType to the store.
Do nothing if the DisposableType is already in the store.
The same DisposableType .
A DisposableType .
Add multiple DisposableTypes to the store.
Do nothing if a DisposableType is already in the store.
The same array of DisposableTypes.
An array of DisposableTypes.
Add each DisposableType to the store.
Do nothing if a DisposableType is already in the store.
The same array of DisposableTypes.
An array of DisposableTypes.
Flush and clear all of the Disposers and IDisposables in the store.
Invoke the DisposableType and remove it from the store at the specific key.
Optional
disposable: DisposableTypeThe DisposableType to be flushed. Flush all if omitted.
Check if a DisposableType is in the store.
true
if the DisposableType is in the store, otherwise false
.
The DisposableType.
Invoke the executor function and add the returned DisposableType to the store.
Do nothing if the DisposableType is already in the store.
The returned DisposableType.
A function that returns a DisposableType.
Invoke the executor function and add the returned DisposableType to the store.
Do nothing if null | undefined
is returned or the returned DisposableType is already in the store.
The returned DisposableType, or undefined
if the executor returns null
.
A function that returns either a DisposableType or null
.
Invoke the executor function and add each DisposableType in the returned array to the store.
Do nothing if a DisposableType is already in the store.
The returned array of DisposableTypes.
A function that returns an array of DisposableTypes.
Invoke the executor function and the returned DisposableTypes to the store. Do nothing if undefined | null
is returned.
Do nothing if a DisposableType is already in the store.
The returned array of DisposableTypes, or undefined
if the executor returns undefined | null
.
A function that returns either an array of DisposableTypes or undefined | null
.
Invoke the executor function and the returned DisposableTypes to the store. Do nothing if undefined | null
is returned.
Do nothing if a DisposableType is already in the store.
The returned array of DisposableTypes, or undefined
if the executor returns undefined | null
.
A function that returns either an array of DisposableTypes or undefined | null
.
Remove the DisposableType from the store. Does not invoke the removed DisposableType.
true
if the DisposableType is found and removed, otherwise false
.
The DisposableType to be flushed.
Get the number of DisposableTypes in the store.
Flush and clear all of the Disposers and IDisposables in the store.