mwg API
    Preparing search index...

    Interface StateExtension<T>

    interface StateExtension<T extends StateValue = StateValue> {
        capture: () => T;
        id: string;
        migrations?: Readonly<Record<number, (state: StateValue) => T>>;
        remove?: () => void;
        reset?: () => void;
        restore: (state: T) => void;
        version?: number;
    }

    Type Parameters

    Index
    capture: () => T

    capture the extension's complete serializable state

    id: string

    stable key written into a snapshot

    migrations?: Readonly<Record<number, (state: StateValue) => T>>

    Migrations are keyed by destination version and run in order.

    remove?: () => void

    Optional cleanup when the extension is deliberately absent from a restored save.

    reset?: () => void

    Optional reset used when a save predates this extension.

    restore: (state: T) => void

    restore a previously captured state atomically

    version?: number

    Current schema version for this extension, independent of other save data.