type-pubsub
Version:
TypeScript decorators implementing the Publish/Subscribe pattern for Node.js and browser
12 lines (11 loc) • 434 B
TypeScript
import { PubSubService } from "./pubsub-service.type";
/**
* Message handler function.
* Example usage:
* ```
* PubSub.subscribe('TEST_MESSAGE', (data, message, channel, handler) => {
* console.log(data);
* });
* ```
*/
export declare type MessageHandler<DataType, MessageType> = (data: DataType, message: MessageType, channel: PubSubService<MessageType>, handler: MessageHandler<DataType, MessageType>) => void;