Skip to content
ClassAssets & Loading@public

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.

ts
export declare class FlxLoadingSession

Constructors

ts
constructor(parentSignal?: AbortSignal)

Constructs a new instance of the FlxLoadingSession class

ParameterTypeDescription
parentSignalAbortSignal-

Properties

PropertyModifiersTypeDescription
signalreadonlyAbortSignal-
snapshotreadonlyFlxLoadingSnapshot-

Methods

cancel()

ts
cancel(message?: string): void

Abort pending application-level work and publish cancellation.

Parameters:

ParameterTypeDescription
messagestring-

Returns: void

complete()

ts
complete(message?: string): void

Mark the current run ready.

Parameters:

ParameterTypeDescription
messagestring-

Returns: void

destroy()

ts
destroy(): void

Returns: void

fail()

ts
fail(error: FlxLoadingError, retry?: () => void): void

Publish a retryable or terminal failure.

Parameters:

ParameterTypeDescription
errorFlxLoadingError-
retry() => void-

Returns: void

loadBundle()

ts
loadBundle<T = Record<string, unknown>>(assets: FlxAssets, name: string | string[], options: FlxLoadingBundleOptions): Promise<T>

Load a Pixi asset bundle while publishing its progress.

Parameters:

ParameterTypeDescription
assetsFlxAssets-
namestring | string[]-
optionsFlxLoadingBundleOptions-

Returns: Promise<T>

report()

ts
report(update: FlxLoadingUpdate): void

Publish a monotonic progress update for the current run.

Parameters:

ParameterTypeDescription
updateFlxLoadingUpdate-

Returns: void

start()

ts
start(stage?: FlxLoadingStage, message?: string, progress?: number | null): void

Start a new run, including a retry after an error.

Parameters:

ParameterTypeDescription
stageFlxLoadingStage-
messagestring-
progressnumber | null-

Returns: void

subscribe()

ts
subscribe(listener: (snapshot: FlxLoadingSnapshot) => void): () => void

Subscribe to state changes. The current snapshot is emitted immediately.

Parameters:

ParameterTypeDescription
listener(snapshot: FlxLoadingSnapshot) => void-

Returns: () => void

task()

ts
task<T>(options: FlxLoadingTaskOptions, action: (context: FlxLoadingTaskContext) => Promise<T> | T): Promise<T>

Run a custom operation mapped into a range of overall progress.

Parameters:

ParameterTypeDescription
optionsFlxLoadingTaskOptions-
action(context: FlxLoadingTaskContext) => Promise<T> | T-

Returns: Promise<T>

Released under the MIT License.