ddan-js 2.5.6 → 2.5.7
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/bin/types/index.d.ts +8 -8
- package/bin/types/modules/hook/base.d.ts +2 -1
- package/bin/types/modules/hook/hooker.d.ts +4 -3
- package/bin/types/modules/hook/index.d.ts +4 -4
- package/bin/types/modules/hook/modules/pipeline.d.ts +2 -2
- package/bin/types/typings/index.d.ts +2 -0
- package/package.json +1 -1
package/bin/types/index.d.ts
CHANGED
|
@@ -186,17 +186,17 @@ declare const dUtil: {
|
|
|
186
186
|
};
|
|
187
187
|
declare const dHook: {
|
|
188
188
|
sleep: (ms?: number) => Promise<unknown>;
|
|
189
|
-
run: <T = any>(task?:
|
|
190
|
-
exec: (func:
|
|
189
|
+
run: <T = any>(task?: import("./typings").Ddan.PFunction<T> | undefined, wait?: number) => Promise<[any, undefined] | [null, T]>;
|
|
190
|
+
exec: (func: import("./typings").Ddan.PFunction<any>, taskId?: string) => import("./typings").Ddan.SafeResult<any>;
|
|
191
191
|
debounce: typeof import("./modules/hook/debounce").default;
|
|
192
192
|
throttle: typeof import("./modules/hook/throttle").default;
|
|
193
193
|
task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
|
|
194
194
|
mutex: typeof import("./modules/hook/mutex").default;
|
|
195
195
|
polling: typeof import("./modules/hook/polling").default;
|
|
196
|
-
pipe: (func:
|
|
196
|
+
pipe: (func: import("./typings").Ddan.PFunction<any>) => import("./modules/hook/modules/pipeline").default;
|
|
197
197
|
pipeline: () => import("./modules/hook/modules/pipeline").default;
|
|
198
198
|
to: <T_1 = any, U extends object = any>(promise: Promise<T_1>, errorExt?: object | undefined) => Promise<[null, T_1] | [U, undefined]>;
|
|
199
|
-
go: <T_2 = any>(task?:
|
|
199
|
+
go: <T_2 = any>(task?: import("./typings").Ddan.PFunction<T_2> | undefined) => Promise<[any, undefined] | [null, T_2]>;
|
|
200
200
|
delay: (ms?: number) => Promise<unknown>;
|
|
201
201
|
safeDo: <T_3 = any>(func: any) => Promise<[null, T_3] | [any, undefined]>;
|
|
202
202
|
base64: {
|
|
@@ -471,17 +471,17 @@ declare const _default: {
|
|
|
471
471
|
};
|
|
472
472
|
hook: {
|
|
473
473
|
sleep: (ms?: number) => Promise<unknown>;
|
|
474
|
-
run: <T = any>(task?:
|
|
475
|
-
exec: (func:
|
|
474
|
+
run: <T = any>(task?: import("./typings").Ddan.PFunction<T> | undefined, wait?: number) => Promise<[any, undefined] | [null, T]>;
|
|
475
|
+
exec: (func: import("./typings").Ddan.PFunction<any>, taskId?: string) => import("./typings").Ddan.SafeResult<any>;
|
|
476
476
|
debounce: typeof import("./modules/hook/debounce").default;
|
|
477
477
|
throttle: typeof import("./modules/hook/throttle").default;
|
|
478
478
|
task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
|
|
479
479
|
mutex: typeof import("./modules/hook/mutex").default;
|
|
480
480
|
polling: typeof import("./modules/hook/polling").default;
|
|
481
|
-
pipe: (func:
|
|
481
|
+
pipe: (func: import("./typings").Ddan.PFunction<any>) => import("./modules/hook/modules/pipeline").default;
|
|
482
482
|
pipeline: () => import("./modules/hook/modules/pipeline").default;
|
|
483
483
|
to: <T_1 = any, U extends object = any>(promise: Promise<T_1>, errorExt?: object | undefined) => Promise<[null, T_1] | [U, undefined]>;
|
|
484
|
-
go: <T_2 = any>(task?:
|
|
484
|
+
go: <T_2 = any>(task?: import("./typings").Ddan.PFunction<T_2> | undefined) => Promise<[any, undefined] | [null, T_2]>;
|
|
485
485
|
delay: (ms?: number) => Promise<unknown>;
|
|
486
486
|
safeDo: <T_3 = any>(func: any) => Promise<[null, T_3] | [any, undefined]>;
|
|
487
487
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Ddan } from '../../typings';
|
|
1
2
|
declare function to<T = any, U extends object = any>(promise: Promise<T>, errorExt?: object): Promise<[null, T] | [U, undefined]>;
|
|
2
3
|
declare const _default: {
|
|
3
4
|
to: typeof to;
|
|
4
|
-
go: <T = any>(task?:
|
|
5
|
+
go: <T = any>(task?: Ddan.PFunction<T> | undefined) => Promise<[any, undefined] | [null, T]>;
|
|
5
6
|
delay: (ms?: number) => Promise<unknown>;
|
|
6
7
|
safeDo: <T_1 = any>(func: any) => Promise<[null, T_1] | [any, undefined]>;
|
|
7
8
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import DPipeline from './modules/pipeline';
|
|
2
|
+
import { Ddan } from '../../typings';
|
|
2
3
|
declare const DHooker_base: {
|
|
3
4
|
new (): {};
|
|
4
5
|
__instance__: any;
|
|
@@ -6,11 +7,11 @@ declare const DHooker_base: {
|
|
|
6
7
|
readonly I: DHooker;
|
|
7
8
|
};
|
|
8
9
|
export default class DHooker extends DHooker_base {
|
|
9
|
-
__lockedMap: Map<string,
|
|
10
|
+
__lockedMap: Map<string, Ddan.SafeResult<any>>;
|
|
10
11
|
pipeline: DPipeline;
|
|
11
12
|
constructor();
|
|
12
|
-
lock(id: string, func:
|
|
13
|
+
lock(id: string, func: Ddan.PFunction): Promise<[any, undefined] | [null, any]> | undefined;
|
|
13
14
|
unlock(id: string): void;
|
|
14
|
-
exec(func:
|
|
15
|
+
exec(func: Ddan.PFunction, taskId: string): Ddan.SafeResult;
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
@@ -11,20 +11,20 @@ import DPipeline from './modules/pipeline';
|
|
|
11
11
|
* @param wait 最小等待时间,单位毫秒
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
declare function run<T = any>(task?:
|
|
14
|
+
declare function run<T = any>(task?: Ddan.PFunction<T>, wait?: number): Promise<[any, undefined] | [null, T]>;
|
|
15
15
|
declare const _default: {
|
|
16
16
|
sleep: (ms?: number) => Promise<unknown>;
|
|
17
17
|
run: typeof run;
|
|
18
|
-
exec: (func:
|
|
18
|
+
exec: (func: Ddan.PFunction<any>, taskId?: string) => Ddan.SafeResult<any>;
|
|
19
19
|
debounce: typeof debounce;
|
|
20
20
|
throttle: typeof throttle;
|
|
21
21
|
task: (param?: Ddan.Func1<any, any> | undefined) => DPipeTask;
|
|
22
22
|
mutex: typeof mutex;
|
|
23
23
|
polling: typeof polling;
|
|
24
|
-
pipe: (func:
|
|
24
|
+
pipe: (func: Ddan.PFunction<any>) => DPipeline;
|
|
25
25
|
pipeline: () => DPipeline;
|
|
26
26
|
to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
|
|
27
|
-
go: <T_1 = any>(task?:
|
|
27
|
+
go: <T_1 = any>(task?: Ddan.PFunction<T_1> | undefined) => Promise<[any, undefined] | [null, T_1]>;
|
|
28
28
|
delay: (ms?: number) => Promise<unknown>;
|
|
29
29
|
safeDo: <T_2 = any>(func: any) => Promise<[null, T_2] | [any, undefined]>;
|
|
30
30
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Ddan } from '../../../typings';
|
|
2
2
|
export default class DPipeline implements Ddan.IPipeline {
|
|
3
|
-
__list:
|
|
3
|
+
__list: Ddan.PFunction[];
|
|
4
4
|
__running: boolean;
|
|
5
5
|
__waitting: boolean;
|
|
6
6
|
constructor();
|
|
7
|
-
pipe(_task?:
|
|
7
|
+
pipe(_task?: Ddan.PFunction): this;
|
|
8
8
|
delay(t?: number): this;
|
|
9
9
|
clear(): this;
|
|
10
10
|
_step(): Promise<void>;
|
|
@@ -6,6 +6,7 @@ export declare namespace Ddan {
|
|
|
6
6
|
}
|
|
7
7
|
type KeyValue<T = any> = Required<IKeyValuePart<T>>;
|
|
8
8
|
type Function = (...args: any[]) => void;
|
|
9
|
+
type PFunction<T = any> = Promise<T> | Function;
|
|
9
10
|
type Callback<T extends any[] = unknown[], R = any> = (...args: T) => R;
|
|
10
11
|
type Action<T extends any[] = unknown[]> = Callback<T, void>;
|
|
11
12
|
type Task<T = any, R = void> = Callback<[T[]], R>;
|
|
@@ -15,6 +16,7 @@ export declare namespace Ddan {
|
|
|
15
16
|
type Func3<T0 = any, T1 = any, T2 = any, R = any> = Callback<[T0, T1, T2], R>;
|
|
16
17
|
type Func4<T0 = any, T1 = any, T2 = any, T3 = any, R = any> = Callback<[T0, T1, T2, T3], R>;
|
|
17
18
|
type Result<T = any> = T | Promise<T>;
|
|
19
|
+
type SafeResult<T = any> = Promise<[any, undefined] | [null, T]>;
|
|
18
20
|
interface IHttpHost {
|
|
19
21
|
href: string;
|
|
20
22
|
url: string;
|