@esfx/events Package
Provides a low-level API for defining events.
Installation
npm i @esfx/events
Usage
import { Event } from "@esfx/events";
class MyService {
private _loadedEvent = Event.create<(this: MyService) => void>(this);
readonly loadedEvent = this._loadedEvent.event;
load() {
// ...
this._loadedEvent.emit();
}
}
const svc = new MyService();
svc.loadedEvent.on(() => console.log("loaded"));
svc.load();
Classes
Event
EventSource
EventSubscription
Interfaces
Event<F>
Type Aliases
EventListener
Declaration
export declare type EventListener<F extends (...args: any[]) => void> = (this: ThisParameterType<F>, ...args: Parameters<F>) => void;
Type Parameters
- F
EventOwner
Declaration
export declare type EventOwner<F extends (...args: any[]) => void> = ThisParameterType<F> extends undefined ? void : ThisParameterType<F>;
Type Parameters
- F