ecspresso
    Preparing search index...

    Interface ReactiveQueryDefinition<Cfg, WithComponents, WithoutComponents, OptionalComponents>

    Definition for a reactive query with enter/exit callbacks

    interface ReactiveQueryDefinition<
        Cfg extends WorldConfig,
        WithComponents extends ComponentKey<Cfg> = ComponentKey<Cfg>,
        WithoutComponents extends ComponentKey<Cfg> = never,
        OptionalComponents extends ComponentKey<Cfg> = never,
    > {
        onEnter?: (
            ctx: ReactiveQueryEnterContext<
                Cfg,
                WithComponents,
                WithoutComponents,
                OptionalComponents,
            >,
        ) => void;
        onExit?: (ctx: ReactiveQueryExitContext<Cfg>) => void;
        optional?: readonly OptionalComponents[];
        parentHas?: readonly (keyof Cfg["components"])[];
        with: readonly WithComponents[];
        without?: readonly WithoutComponents[];
    }

    Type Parameters

    • Cfg extends WorldConfig
    • WithComponents extends ComponentKey<Cfg> = ComponentKey<Cfg>
    • WithoutComponents extends ComponentKey<Cfg> = never
    • OptionalComponents extends ComponentKey<Cfg> = never
    Index

    Properties

    onEnter?: (
        ctx: ReactiveQueryEnterContext<
            Cfg,
            WithComponents,
            WithoutComponents,
            OptionalComponents,
        >,
    ) => void

    Called when an entity starts matching the query

    onExit?: (ctx: ReactiveQueryExitContext<Cfg>) => void

    Called when an entity stops matching the query (receives just the ID since entity may be gone)

    optional?: readonly OptionalComponents[]

    Components to include in the entity type but not require for matching

    parentHas?: readonly (keyof Cfg["components"])[]

    Components the entity's direct parent must have

    with: readonly WithComponents[]

    Components the entity must have

    without?: readonly WithoutComponents[]

    Components the entity must not have