1 | import type { Fn } from "./fn.js";
|
2 | import type { IID } from "./id.js";
|
3 | /**
|
4 | * Event listener.
|
5 | */
|
6 | export declare type Listener = Fn<Event, void>;
|
7 | export interface Event extends IID<PropertyKey> {
|
8 | target?: any;
|
9 | canceled?: boolean;
|
10 | value?: any;
|
11 | }
|
12 | /**
|
13 | * Interface to provide event emitter functionality. Also see
|
14 | * {@link INotifyMixin} decorator mixin.
|
15 | */
|
16 | export interface INotify {
|
17 | addListener(id: string, fn: Listener, scope?: any): boolean;
|
18 | removeListener(id: string, fn: Listener, scope?: any): boolean;
|
19 | /**
|
20 | * Broadcasts all registered listeners for given event type (in order
|
21 | * registration) and returns true if any of them have been successfully
|
22 | * notified.
|
23 | *
|
24 | * @remarks
|
25 | * If a listener canceled the event (by setting {@link Event.canceled}), the
|
26 | * function will stop notifying other listeners and return false. If no
|
27 | * listeners are registered for the event, the function will also return
|
28 | * false.
|
29 | *
|
30 | * @param event
|
31 | */
|
32 | notify(event: Event): boolean;
|
33 | }
|
34 | //# sourceMappingURL=event.d.ts.map |
\ | No newline at end of file |