shared/disposable
Classes
Section titled “Classes”DisposableStore
Section titled “DisposableStore”Defined in: app/src/shared/disposable.ts:36
Collects disposables and releases them together, in reverse order of addition.
Once disposed, the store disposes anything added later immediately, so late registrations cannot leak.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DisposableStore():
DisposableStore
Returns
Section titled “Returns”Accessors
Section titled “Accessors”isDisposed
Section titled “isDisposed”Get Signature
Section titled “Get Signature”get isDisposed():
boolean
Defined in: app/src/shared/disposable.ts:41
Whether DisposableStore.dispose has been called.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”add<
T>(item):T
Defined in: app/src/shared/disposable.ts:50
Adds a disposable to the store.
Type Parameters
Section titled “Type Parameters”T extends Disposable
Parameters
Section titled “Parameters”T
The disposable to own.
Returns
Section titled “Returns”T
The same disposable, for chaining.
dispose()
Section titled “dispose()”dispose():
void
Defined in: app/src/shared/disposable.ts:64
Disposes every item in reverse order. Errors are collected and rethrown after all items were disposed, so one failing cleanup does not keep others alive.
Returns
Section titled “Returns”void
Throws
Section titled “Throws”AggregateError when one or more items failed to dispose.
Implementation of
Section titled “Implementation of”Interfaces
Section titled “Interfaces”Disposable
Section titled “Disposable”Defined in: app/src/shared/disposable.ts:7
Something that holds resources and releases them when Disposable.dispose is called.
Every registration in the browser (a command, an IPC handler, an event listener, a UI
slot) returns a Disposable, so that a module can be switched off without leaks.
Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Defined in: app/src/shared/disposable.ts:9
Releases the resources. Calling it more than once has no further effect.
Returns
Section titled “Returns”void
Functions
Section titled “Functions”isDisposable()
Section titled “isDisposable()”isDisposable(
value):value is Disposable
Defined in: app/src/shared/disposable.ts:87
Tells whether a value implements Disposable.
Parameters
Section titled “Parameters”unknown
Any value.
Returns
Section titled “Returns”value is Disposable
toDisposable()
Section titled “toDisposable()”toDisposable(
cleanup):Disposable
Defined in: app/src/shared/disposable.ts:17
Wraps a cleanup function in a Disposable that runs it at most once.
Parameters
Section titled “Parameters”cleanup
Section titled “cleanup”() => void
Function that releases the resource.
Returns
Section titled “Returns”A disposable that calls cleanup on the first dispose().