Event Class
Package: @esfx/events
Declaration
export declare class Event<F extends (...args: any[]) => void>
Properties
count
Declaration
get count(): number;
Property Value
owner
Declaration
get owner(): ThisParameterType<F>;
Property Value
ThisParameterType<F>
Methods
addListener(listener)
Declaration
addListener(listener: EventListener<F>): EventOwner<F>;
Parameters
- listener
- EventListener<F>
Returns
EventOwner<F>
create()
Declaration
static create<F extends (this: undefined, ...args: any[]) => void>(): EventSource<F>;
Type Parameters
- F
Returns
EventSource<F>
create(owner)
Declaration
static create<F extends (...args: any[]) => void>(owner: ThisParameterType<F>): EventSource<F>;
Type Parameters
- F
Parameters
- owner
- ThisParameterType<F>
Returns
EventSource<F>
listeners()
Declaration
listeners(): IterableIterator<EventListener<F>>;
Returns
IterableIterator<EventListener<F>>
off(listener)
Declaration
off(listener: EventListener<F>): EventOwner<F>;
Parameters
- listener
- EventListener<F>
Returns
EventOwner<F>
on(listener)
Declaration
on(listener: EventListener<F>): EventOwner<F>;
Parameters
- listener
- EventListener<F>
Returns
EventOwner<F>
once(listener)
Declaration
once(listener: EventListener<F>): EventOwner<F>;
Parameters
- listener
- EventListener<F>
Returns
EventOwner<F>
prependListener(listener)
Declaration
prependListener(listener: EventListener<F>): EventOwner<F>;
Parameters
- listener
- EventListener<F>
Returns
EventOwner<F>
prependOnceListener(listener)
Declaration
prependOnceListener(listener: EventListener<F>): EventOwner<F>;
Parameters
- listener
- EventListener<F>
Returns
EventOwner<F>
rawListeners()
Declaration
rawListeners(): IterableIterator<EventListener<F>>;
Returns
IterableIterator<EventListener<F>>
removeAllListeners()
Declaration
removeAllListeners(): EventOwner<F>;
Returns
EventOwner<F>
removeListener(listener)
Declaration
removeListener(listener: EventListener<F>): EventOwner<F>;
Parameters
- listener
- EventListener<F>
Returns
EventOwner<F>
subscribe(listener, options)
Declaration
subscribe(listener: EventListener<F>, options?: {
once?: boolean;
prepend?: boolean;
}): EventSubscription<ThisParameterType<F>>;
Parameters
- listener
- EventListener<F>
- options
- { once?: boolean; prepend?: boolean; }
Returns
EventSubscription<ThisParameterType<F>>