ecspresso
    Preparing search index...

    Interface ReactiveQueryDefinition<ComponentTypes, WithComponents, WithoutComponents, OptionalComponents>

    Definition for a reactive query with enter/exit callbacks

    interface ReactiveQueryDefinition<
        ComponentTypes extends Record<string, any>,
        WithComponents extends keyof ComponentTypes = keyof ComponentTypes,
        WithoutComponents extends keyof ComponentTypes = never,
        OptionalComponents extends keyof ComponentTypes = never,
    > {
        onEnter?: (
            entity: FilteredEntity<
                ComponentTypes,
                WithComponents,
                WithoutComponents,
                OptionalComponents,
            >,
        ) => void;
        onExit?: (entityId: number) => void;
        optional?: readonly OptionalComponents[];
        parentHas?: readonly (keyof ComponentTypes)[];
        with: readonly WithComponents[];
        without?: readonly WithoutComponents[];
    }

    Type Parameters

    Index

    Properties

    onEnter?: (
        entity: FilteredEntity<
            ComponentTypes,
            WithComponents,
            WithoutComponents,
            OptionalComponents,
        >,
    ) => void

    Called when an entity starts matching the query

    onExit?: (entityId: number) => 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 ComponentTypes)[]

    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