UNPKG

routup

Version:

Routup is a minimalistic http based routing framework.

18 lines (17 loc) 716 B
import { PassThrough } from 'readable-stream'; import type { Response } from '../../types'; import type { EventStreamListener, EventStreamMessage } from './types'; export declare class EventStream { protected response: Response; protected passThrough: PassThrough; protected flushed: boolean; protected eventHandlers: Record<string, EventStreamListener[]>; constructor(response: Response); protected open(): void; write(message: EventStreamMessage): void; write(message: string): void; end(): void; on(event: 'close', listener: EventStreamListener): void; on(event: 'error', listener: EventStreamListener): void; protected emit(event: string, ...args: any[]): void; }