@infra-blocks/types 0.6.0-alpha.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/events.d.ts +9 -0
- package/lib/cjs/events.js +9 -0
- package/lib/cjs/events.js.map +1 -1
- package/lib/esm/events.d.ts +9 -0
- package/lib/esm/events.js +9 -0
- package/lib/esm/events.js.map +1 -1
- package/package.json +1 -1
package/lib/cjs/events.d.ts
CHANGED
|
@@ -35,5 +35,14 @@ export interface EmitterLike<E extends Events> {
|
|
|
35
35
|
export declare class EmitterLikeBase<E extends Events> implements EmitterLike<E> {
|
|
36
36
|
protected readonly emitter: EventEmitter;
|
|
37
37
|
on<Event extends keyof E>(event: Event, handler: E[Event]): this;
|
|
38
|
+
/**
|
|
39
|
+
* Emits the event with the given arguments.
|
|
40
|
+
*
|
|
41
|
+
* @param event The event. This needs to be a key of the events type associated with this class.
|
|
42
|
+
* @param args The arguments to pass to the event handler. The types are inferred from the
|
|
43
|
+
* handler associated with the event in the events type associated with this class.
|
|
44
|
+
*
|
|
45
|
+
* @returns Whether the event is being listened to.
|
|
46
|
+
*/
|
|
38
47
|
protected emit<Event extends keyof E>(event: Event, ...args: Parameters<E[Event]>): boolean;
|
|
39
48
|
}
|
package/lib/cjs/events.js
CHANGED
|
@@ -20,6 +20,15 @@ class EmitterLikeBase {
|
|
|
20
20
|
this.emitter.on(event.toString(), handler);
|
|
21
21
|
return this;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Emits the event with the given arguments.
|
|
25
|
+
*
|
|
26
|
+
* @param event The event. This needs to be a key of the events type associated with this class.
|
|
27
|
+
* @param args The arguments to pass to the event handler. The types are inferred from the
|
|
28
|
+
* handler associated with the event in the events type associated with this class.
|
|
29
|
+
*
|
|
30
|
+
* @returns Whether the event is being listened to.
|
|
31
|
+
*/
|
|
23
32
|
emit(event, ...args) {
|
|
24
33
|
return this.emitter.emit(event.toString(), ...args);
|
|
25
34
|
}
|
package/lib/cjs/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAuC;AA4BvC;;;;;;;;GAQG;AACH,MAAa,eAAe;IACP,OAAO,GAAG,IAAI,qBAAY,EAAE,CAAC;IAEhD,EAAE,CAAwB,KAAY,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAuC;AA4BvC;;;;;;;;GAQG;AACH,MAAa,eAAe;IACP,OAAO,GAAG,IAAI,qBAAY,EAAE,CAAC;IAEhD,EAAE,CAAwB,KAAY,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACO,IAAI,CACZ,KAAY,EACZ,GAAG,IAA0B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AAvBD,0CAuBC"}
|
package/lib/esm/events.d.ts
CHANGED
|
@@ -35,5 +35,14 @@ export interface EmitterLike<E extends Events> {
|
|
|
35
35
|
export declare class EmitterLikeBase<E extends Events> implements EmitterLike<E> {
|
|
36
36
|
protected readonly emitter: EventEmitter;
|
|
37
37
|
on<Event extends keyof E>(event: Event, handler: E[Event]): this;
|
|
38
|
+
/**
|
|
39
|
+
* Emits the event with the given arguments.
|
|
40
|
+
*
|
|
41
|
+
* @param event The event. This needs to be a key of the events type associated with this class.
|
|
42
|
+
* @param args The arguments to pass to the event handler. The types are inferred from the
|
|
43
|
+
* handler associated with the event in the events type associated with this class.
|
|
44
|
+
*
|
|
45
|
+
* @returns Whether the event is being listened to.
|
|
46
|
+
*/
|
|
38
47
|
protected emit<Event extends keyof E>(event: Event, ...args: Parameters<E[Event]>): boolean;
|
|
39
48
|
}
|
package/lib/esm/events.js
CHANGED
|
@@ -14,6 +14,15 @@ export class EmitterLikeBase {
|
|
|
14
14
|
this.emitter.on(event.toString(), handler);
|
|
15
15
|
return this;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Emits the event with the given arguments.
|
|
19
|
+
*
|
|
20
|
+
* @param event The event. This needs to be a key of the events type associated with this class.
|
|
21
|
+
* @param args The arguments to pass to the event handler. The types are inferred from the
|
|
22
|
+
* handler associated with the event in the events type associated with this class.
|
|
23
|
+
*
|
|
24
|
+
* @returns Whether the event is being listened to.
|
|
25
|
+
*/
|
|
17
26
|
emit(event, ...args) {
|
|
18
27
|
return this.emitter.emit(event.toString(), ...args);
|
|
19
28
|
}
|
package/lib/esm/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AA4BvC;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACP,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IAEhD,EAAE,CAAwB,KAAY,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AA4BvC;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACP,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IAEhD,EAAE,CAAwB,KAAY,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACO,IAAI,CACZ,KAAY,EACZ,GAAG,IAA0B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;CACF"}
|