UNPKG

@allgemein/eventbus

Version:
31 lines (30 loc) 941 B
import { ISubscribeOptions } from '../bus/ISubscribeOptions'; /** * Subscribe a method for listening for some class fired by eventbus * * ``` * export class SomeClass { * * @subscribe(GreatEvent) * onEvent(event: GreatEvent){ * .. do great things .. * } * * } * ``` * * The function can be also used directly to register some event on the fly. * * ``` * ... * const instance = new SomeClass(); * subscribe(GreatEvent)(instance, 'myMethod'); * unsubcribe(instance, GreatEvent 'myMethod'); * ... * ``` * @param options */ export declare function subscribe(options: ISubscribeOptions): Function; export declare function subscribe(eventClass: Function, configuration?: string): Function; export declare function subscribe(eventClass: Function, configuration: string, configurationOptions?: any): Function; export declare function unsubscribe(target: Function | any, eventClass: Function, method: string): void;