export type PresenceChangeEvent = { type?: 'join' | 'leave' id: string info?: T } export type PresenceInfoEvent = { type: 'info' total: number records: PresenceChangeEvent[] } export type PresenceErrorEvent = { type: 'error' } export type PresenceEvent = | PresenceChangeEvent | PresenceInfoEvent | PresenceErrorEvent export type PresenceState = { [key: string]: T } export type PresenceChannel = { on(event: string, callback: (msg: PresenceEvent) => void): () => void perform(action: string, data: object): Promise> } export class Presence { constructor(channel: PresenceChannel) reset(): void dispose(): void join(id: string | number, info: string | object): Promise leave(): Promise info(): Promise | undefined> }