ecspresso
    Preparing search index...

    Interface ScreenDefinition<Config, State, W>

    Definition for a screen including its state, lifecycle hooks, and requirements

    interface ScreenDefinition<
        Config extends Record<string, unknown> = Record<string, never>,
        State extends Record<string, unknown> = Record<string, never>,
        W = default<any>,
    > {
        initialState: (config: Config) => State;
        onEnter?: (ctx: { config: Config; ecs: W }) => void | Promise<void>;
        onExit?: (ecs: W) => void | Promise<void>;
        requiredAssetGroups?: readonly string[];
        requiredAssets?: readonly string[];
    }

    Type Parameters

    • Config extends Record<string, unknown> = Record<string, never>
    • State extends Record<string, unknown> = Record<string, never>
    • W = default<any>
    Index

    Properties

    initialState: (config: Config) => State

    Function to create initial state from config

    onEnter?: (ctx: { config: Config; ecs: W }) => void | Promise<void>

    Lifecycle hook called when entering this screen

    onExit?: (ecs: W) => void | Promise<void>

    Lifecycle hook called when exiting this screen

    requiredAssetGroups?: readonly string[]

    Asset groups that must be loaded before entering this screen

    requiredAssets?: readonly string[]

    Asset keys that must be loaded before entering this screen