@ihadeed/transport-commons
Version:
Shared functionality for websocket providers
25 lines (24 loc) • 1.08 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from "events";
import { Channel } from './channel/base';
import { keys, Event, Publisher } from './mixins';
import { Application } from '@ihadeed/feathers';
declare module '@ihadeed/feathers' {
interface ServiceAddons<T> {
publish(publisher: Publisher<T>): this;
publish(event: Event, publisher: Publisher<T>): this;
registerPublisher(publisher: Publisher<T>): this;
registerPublisher(event: Event, publisher: Publisher<T>): this;
}
interface Application<ServiceTypes extends KeyValue = any> extends EventEmitter {
channels: string[];
channel(name: string[]): Channel;
channel(...names: string[]): Channel;
publish<T>(publisher: Publisher<T>): this;
publish<T>(event: Event, publisher: Publisher<T>): this;
registerPublisher<T>(publisher: Publisher<T>): this;
registerPublisher<T>(event: Event, publisher: Publisher<T>): this;
}
}
export { keys };
export declare function channels(): (app: Application<any>) => void;