/** * relatively simple event publish/subscribe mechanism. * not as simple as it used to be. * * UPDATE removing unecessary interface (not sure what that * was for, but no one else is using it). */ export declare class EventSource { private verbose; private log_id?; /** pending events */ private queue; /** flag indicating whether we have already triggered a callback */ private dispatched; /** regular subscriptions */ private subscribers; constructor(verbose?: boolean, log_id?: string | undefined); /** * FIXME: does anybody call this with an array? it's no longer * necessary for multiple messages to prevent extra callbacks... */ Publish(event: T | T[]): void; /** * subscription returns a token which can be used to cancel subscription. * this token is a number, guaranteed to be !0 so you can test for falsy. */ Subscribe(subscriber: (event: T) => void): number; /** cancel a single subscription */ Cancel(token: number): void; /** * cancel all subscriptions AND ALL PASS-THROUGH SOURCES. */ CancelAll(): void; }