UNPKG

magicbell

Version:
51 lines (50 loc) 1.2 kB
import '../lib/signal-polyfill.js'; import { Client } from '../client/client.js'; import { RequestOptions } from '../client/types.js'; type Event = { id: string; timestamp: number; encoding: string; channel: string; } & ({ name: 'notifications/new'; data: { id: string; }; } | { name: 'notifications/read'; data: { id: string; client_id: string; }; } | { name: 'notifications/read/all'; data: { client_id: string; }; } | { name: 'notifications/seen/all'; data: { client_id: string; }; } | { name: 'notifications/unread'; data: { id: string; client_id: string; }; } | { name: 'notifications/delete'; data: { id: string; client_id: string | null; }; }); type IterableEventSource<TNode> = { [Symbol.asyncIterator](): Iterator<TNode>; forEach(cb: (node: TNode, index: number) => void | boolean | Promise<void | boolean>): Promise<void>; close(): void; }; export type Listener = (options?: RequestOptions) => IterableEventSource<Event>; export declare function createListener(client: InstanceType<typeof Client>): Listener; export {};