@robotical/sensors-dashboard
Version:
A dashboard tool for depicting Marty data by Robotical
32 lines (31 loc) • 1.04 kB
TypeScript
export type ListenerOptionsType = {
[key: string]: any;
type: EventType;
subtype: string;
whoAmI?: string;
addonInput?: string;
value?: number;
};
export type ListenerType = (options: ListenerOptionsType) => void;
export type EventType = `on${string}=>${string}Change` | `on${string}Change`;
declare class EventDispatcher {
_listeners: ({
type: EventType;
subtype: string;
listener: ListenerType;
options: {
once: boolean;
};
})[];
constructor();
hasEventListener(type: EventType, subtype: string, listener: ListenerType): boolean;
addEventListener(type: EventType, subtype: string, listener: ListenerType): this;
removeEventListener(type: EventType, subtype: string, listener: ListenerType): this;
removeEventListenerBasedOnType(type: EventType, listener: ListenerType): this;
removeEventListeners(): this;
dispatchEvent(evt: {
type: EventType;
[key: string]: any;
}): this;
}
export default EventDispatcher;