boardgame.io
Version:
library for turn-based games
12 lines (9 loc) • 366 B
text/typescript
/** Generic interface for pub-subs. */
export interface GenericPubSub<T> {
// Publish an event for a match.
publish(channelId: string, payload: T);
// Subscribes to events related to a single match.
subscribe(channelId: string, callback: (payload: T) => void): void;
// Cleans up subscription for a given channel.
unsubscribeAll(channelId: string);
}