Class ManagedPromise
Index
Constructors
constructor
- new
Managed (): ManagedPromisePromise Returns ManagedPromise
Accessors
isActive
- get isActive(): boolean
Returns boolean
Whether there is an active managed Promise.
isProcessing
- get isProcessing(): boolean
Returns boolean
Whether there is an active managed Promise and resolution is currently being processed.
Static
logging
- get logging(): boolean
Returns boolean
Whether global logging is enabled.
- set logging(logging): void
Sets global logging enabled state.
Parameters
- logging: boolean
New logging enabled state.
Returns void
- logging: boolean
Methods
create
- create<T>(opts?): Promise<T>
Resolves any current Promise with undefined and creates a new current Promise.
Type Parameters
Parameters
Optional
opts: {
reuse?: boolean;
}Options.
Optional
reuse?: booleanWhen true if there is an existing live Promise it is returned immediately.
Returns Promise<T>
The new current managed Promise.
Provides management of a single Promise that can be shared and accessed across JS & Svelte components. This allows a Promise to be created and managed as part of the TRL application lifecycle and accessed safely in various control flow scenarios. When resolution of the current managed Promise starts further interaction is prevented.
Note: to enable debugging / log statements set the static
logging
variable to true.