Class Emitter<HandlerFuncs>
Type Parameters
HandlerFuncs extends HandlerFuncTypeHash
Constructors
constructor
- new Emitter<HandlerFuncs>(): Emitter<HandlerFuncs>
Type Parameters
HandlerFuncs extends HandlerFuncTypeHash
Returns Emitter<HandlerFuncs>
Properties
Private handlers
handlers: any
Private options
options: any
Private thisContext
thisContext: any
Methods
hasHandlers
- hasHandlers(type: keyof HandlerFuncs): boolean
Parameters
Returns boolean
off
- off<Prop>(type: Prop, handler?: HandlerFuncs[Prop]): void
Type Parameters
Prop extends string | number | symbol
Parameters
type: Prop
Optional handler: HandlerFuncs[Prop]
Returns void
on
- on<Prop>(type: Prop, handler: HandlerFuncs[Prop]): void
Type Parameters
Prop extends string | number | symbol
Parameters
type: Prop
handler: HandlerFuncs[Prop]
Returns void
setOptions
- setOptions(options: Partial<HandlerFuncs>): void
Parameters
options: Partial<HandlerFuncs>
Returns void
setThisContext
- setThisContext(thisContext: any): void
trigger
- trigger<Prop>(type: Prop, ...args: Parameters<HandlerFuncs[Prop]>): void
Type Parameters
Prop extends string | number | symbol
Parameters
type: Prop
Rest ...args: Parameters<HandlerFuncs[Prop]>
Returns void