FlxLoadingSession
Renderer-independent loading state for both browser boot and in-game screens. Progress is monotonic within one run and can be reset explicitly for retry.
export declare class FlxLoadingSessionConstructors
constructor(parentSignal?: AbortSignal)Constructs a new instance of the FlxLoadingSession class
| Parameter | Type | Description |
|---|---|---|
parentSignal | AbortSignal | - |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
signal | readonly | AbortSignal | - |
snapshot | readonly | FlxLoadingSnapshot | - |
Methods
cancel()
cancel(message?: string): voidAbort pending application-level work and publish cancellation.
Parameters:
| Parameter | Type | Description |
|---|---|---|
message | string | - |
Returns: void
complete()
complete(message?: string): voidMark the current run ready.
Parameters:
| Parameter | Type | Description |
|---|---|---|
message | string | - |
Returns: void
destroy()
destroy(): voidReturns: void
fail()
fail(error: FlxLoadingError, retry?: () => void): voidPublish a retryable or terminal failure.
Parameters:
| Parameter | Type | Description |
|---|---|---|
error | FlxLoadingError | - |
retry | () => void | - |
Returns: void
loadBundle()
loadBundle<T = Record<string, unknown>>(assets: FlxAssets, name: string | string[], options: FlxLoadingBundleOptions): Promise<T>Load a Pixi asset bundle while publishing its progress.
Parameters:
| Parameter | Type | Description |
|---|---|---|
assets | FlxAssets | - |
name | string | string[] | - |
options | FlxLoadingBundleOptions | - |
Returns: Promise<T>
report()
report(update: FlxLoadingUpdate): voidPublish a monotonic progress update for the current run.
Parameters:
| Parameter | Type | Description |
|---|---|---|
update | FlxLoadingUpdate | - |
Returns: void
start()
start(stage?: FlxLoadingStage, message?: string, progress?: number | null): voidStart a new run, including a retry after an error.
Parameters:
| Parameter | Type | Description |
|---|---|---|
stage | FlxLoadingStage | - |
message | string | - |
progress | number | null | - |
Returns: void
subscribe()
subscribe(listener: (snapshot: FlxLoadingSnapshot) => void): () => voidSubscribe to state changes. The current snapshot is emitted immediately.
Parameters:
| Parameter | Type | Description |
|---|---|---|
listener | (snapshot: FlxLoadingSnapshot) => void | - |
Returns: () => void
task()
task<T>(options: FlxLoadingTaskOptions, action: (context: FlxLoadingTaskContext) => Promise<T> | T): Promise<T>Run a custom operation mapped into a range of overall progress.
Parameters:
| Parameter | Type | Description |
|---|---|---|
options | FlxLoadingTaskOptions | - |
action | (context: FlxLoadingTaskContext) => Promise<T> | T | - |
Returns: Promise<T>