@javelin/ecs
Version:
30 lines • 840 B
TypeScript
export declare type Topic<D = unknown> = {
/**
* Provides iterator syntax to the consumers of a topic.
*/
[Symbol.iterator](): IterableIterator<D>;
/**
* Pushes an event to the topic so that it can be consumed by downstream
* systems after the next call to flush().
* @param event Event data
*/
push(event: D): void;
/**
* Push an event to be consumed immediately.
* @param event Event data
*/
pushImmediate(event: D): void;
/**
* Transition all staged events to be consumed on the next iteration.
*/
flush(): void;
/**
* Clear all events from the queue (both staged and ready).
*/
clear(): void;
};
/**
* Create a topic.
*/
export declare const createTopic: <$Event = unknown>() => Topic<$Event>;
//# sourceMappingURL=topic.d.ts.map