ecspresso
    Preparing search index...

    Interface CoroutineHelpers<W>

    Type-safe coroutine helpers that validate event names against a world's event types. Use createCoroutineHelpers<typeof ecs>() to get compile-time validation.

    interface CoroutineHelpers<W extends AnyECSpresso> {
        createCoroutine: (
            generator: CoroutineGenerator,
            options?: { onComplete?: (data: CoroutineEventData) => void },
        ) => Pick<CoroutineComponentTypes, "coroutine">;
        waitForEvent: <E extends string>(
            eventBus: {
                subscribe(
                    type: E,
                    cb: (data: EventsOfWorld<W>[E]) => void,
                ): () => void;
            },
            eventType: E,
            filter?: (data: EventsOfWorld<W>[E]) => boolean,
        ) => CoroutineGenerator;
    }

    Type Parameters

    Index

    Properties

    createCoroutine: (
        generator: CoroutineGenerator,
        options?: { onComplete?: (data: CoroutineEventData) => void },
    ) => Pick<CoroutineComponentTypes, "coroutine">
    waitForEvent: <E extends string>(
        eventBus: {
            subscribe(type: E, cb: (data: EventsOfWorld<W>[E]) => void): () => void;
        },
        eventType: E,
        filter?: (data: EventsOfWorld<W>[E]) => boolean,
    ) => CoroutineGenerator