1 | import EventSource from "eventsource";
|
2 | type Severity = "info" | "error";
|
3 | interface Options {
|
4 | source: string;
|
5 | target: string;
|
6 | logger?: Pick<Console, Severity>;
|
7 | fetch?: any;
|
8 | }
|
9 | declare class Client {
|
10 | source: string;
|
11 | target: string;
|
12 | fetch: typeof global.fetch;
|
13 | logger: Pick<Console, Severity>;
|
14 | events: EventSource;
|
15 | constructor({ source, target, logger, fetch, }: Options);
|
16 | static createChannel({ fetch }?: {
|
17 | fetch?: typeof globalThis.fetch | undefined;
|
18 | }): Promise<string>;
|
19 | onmessage(msg: any): Promise<void>;
|
20 | onopen(): void;
|
21 | onerror(err: any): void;
|
22 | start(): EventSource;
|
23 | }
|
24 | export = Client;
|