@wooksjs/event-core 0.3.1 → 0.3.3
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/dist/index.cjs +0 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +0 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TProstoLoggerOptions } from '@prostojs/logger';
|
|
|
4
4
|
export declare function attachHook<V = unknown, T extends object | Function = object, P extends PropertyKey = 'value'>(target: T, opts: {
|
|
5
5
|
get: () => V | undefined;
|
|
6
6
|
set?: (value: V) => void;
|
|
7
|
-
}, name?: P): T &
|
|
7
|
+
}, name?: P): T & THook<V, P>;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Create a new event context
|
|
@@ -63,6 +63,10 @@ export declare interface TGenericEvent {
|
|
|
63
63
|
id?: string;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
export declare type THook<T = string, K extends PropertyKey = 'value'> = {
|
|
67
|
+
[key in K]: T;
|
|
68
|
+
};
|
|
69
|
+
|
|
66
70
|
/**
|
|
67
71
|
* Use existing event context
|
|
68
72
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto';
|
|
2
2
|
import { ProstoLogger, createConsoleTransort, coloredConsole } from '@prostojs/logger';
|
|
3
3
|
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5
4
|
function attachHook(target, opts, name) {
|
|
6
5
|
Object.defineProperty(target, name || 'value', {
|
|
7
6
|
get: opts.get,
|