FlxSave
Port of org.flixel.FlxSave.
Provides namespaced, versioned save slots backed by a replaceable FlxStorageBackend. The default backend is provided by the FlxContext service map (typically LocalStorageBackend).
export declare class FlxSaveProperties
| Property | Modifiers | Type | Description |
|---|---|---|---|
data | - | Record<string, unknown> | null | User-facing data object. Read and mutate freely between bind() and close(). |
name | - | string | null | Slot name set by bind(). |
Methods
bind()
bind(name: string, options?: FlxSaveBindOptions): booleanBind this save to a named slot.
Reads existing data from the backend. If a version is provided and the stored version differs, the migrate callback transforms the data in-place and the result is flushed back immediately.
Parameters:
| Parameter | Type | Description |
|---|---|---|
name | string | The slot name (namespaced automatically by the backend). |
options | FlxSaveBindOptions | Optional version, migration, and backend override. |
Returns: boolean
trueif data was loaded (even if empty),falseon error.
close()
close(): voidFlush and disconnect from the slot.
Returns: void
destroy()
destroy(): voidRelease all resources.
Returns: void
erase()
erase(): booleanErase all stored data for this slot.
Returns: boolean
eraseAsync()
eraseAsync(): Promise<boolean>Await erasure for an asynchronous backend.
Returns: Promise<boolean>
flush()
flush(): FlxSaveResultPersist the current data to the storage backend.
Returns: FlxSaveResult
A typed result indicating success or the failure category.
flushAsync()
flushAsync(): Promise<FlxSaveResult>Persist data and await durable completion for asynchronous backends. Synchronous backends resolve with the same result as link.
Returns: Promise<FlxSaveResult>