@allgemein/eventbus
Version:
36 lines (35 loc) • 1.05 kB
TypeScript
import { IEventListenerDef } from './IEventListenerDef';
import { ISubscriberInfo } from './ISubscriberInfo';
export interface IEventDef {
namespace: string;
clazz: Function;
}
export default class EventBusMeta {
private static self;
private $events;
private $types;
static $(): EventBusMeta;
static toNamespace(clazz: Function | string): string;
getClassForNamespace(ns: string): Function;
getNamespacesForEvent(o: any): string[];
/**
* Remove subscriber information
*
* @param target
* @param eventClass
* @param method
*/
unregister(target: Function | any, eventClass: Function, method: string): void;
/**
* Add subsriber information
* @param options
*/
register(options: IEventListenerDef): void;
registerEventClass(clazz: any): IEventDef;
findEvent(name: string): IEventDef;
/**
* Return subsriber informations for class of object o or driectly for object o
* @param o
*/
getSubscriberInfo(o: any): ISubscriberInfo[];
}