@lincode/events 1.0.26 → 1.0.27
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/event.d.ts +9 -3
- package/lib/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/event.ts +10 -3
- package/src/index.ts +1 -1
package/lib/event.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Cancellable } from "@lincode/promiselikes";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
declare type Emit<T> = (val: T, isState?: boolean) => void;
|
|
3
|
+
declare type On<T> = (cb: (val: T) => void, once?: boolean) => Cancellable;
|
|
4
|
+
declare type GetState<T> = () => T | undefined;
|
|
5
|
+
export declare type EventFunctions = readonly [
|
|
6
|
+
Emit<void>,
|
|
7
|
+
On<void>,
|
|
8
|
+
Emit<void>,
|
|
9
|
+
GetState<void>
|
|
10
|
+
];
|
|
5
11
|
declare const _default: <T = void>() => readonly [Emit<T>, On<T>, Emit<T>, GetState<T>];
|
|
6
12
|
export default _default;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default, default as Events } from "./Events";
|
|
2
|
-
export { default as event,
|
|
2
|
+
export { default as event, EventFunctions } from "./event";
|
package/package.json
CHANGED
package/src/event.ts
CHANGED
|
@@ -37,9 +37,16 @@ class Event<Payload = void> {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
type Emit<T> = (val: T, isState?: boolean) => void
|
|
41
|
+
type On<T> = (cb: (val: T) => void, once?: boolean) => Cancellable
|
|
42
|
+
type GetState<T> = () => T | undefined
|
|
43
|
+
|
|
44
|
+
export type EventFunctions = readonly [
|
|
45
|
+
Emit<void>,
|
|
46
|
+
On<void>,
|
|
47
|
+
Emit<void>,
|
|
48
|
+
GetState<void>
|
|
49
|
+
]
|
|
43
50
|
|
|
44
51
|
export default <T = void>() => {
|
|
45
52
|
const event = new Event<T>()
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default, default as Events } from "./Events"
|
|
2
|
-
export { default as event,
|
|
2
|
+
export { default as event, EventFunctions } from "./event"
|