wenay-common2 1.0.45 → 1.0.48
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/Common/Color.d.ts +3 -0
- package/lib/Common/Color.js +11 -3
- package/lib/Common/ObserveAll2/reactive2.d.ts +32 -0
- package/lib/Common/ObserveAll2/reactive2.js +249 -0
- package/lib/Common/Time.d.ts +8 -0
- package/lib/Common/Time.js +41 -14
- package/lib/Common/async/PromiseArrayListen.d.ts +3 -3
- package/lib/Common/async/PromiseArrayListen.js +10 -14
- package/lib/Common/async/createIterableObject.js +2 -2
- package/lib/Common/async/waitRun.d.ts +12 -5
- package/lib/Common/async/waitRun.js +75 -45
- package/lib/Common/core/Decorator.d.ts +3 -1
- package/lib/Common/core/Decorator.js +7 -3
- package/lib/Common/core/DeepCompareKeys.js +4 -0
- package/lib/Common/core/MemoFunc.js +2 -2
- package/lib/Common/core/common.d.ts +25 -7
- package/lib/Common/core/common.js +118 -38
- package/lib/Common/data/ByteStream.d.ts +1 -1
- package/lib/Common/data/ByteStream.js +31 -27
- package/lib/Common/data/List.d.ts +6 -1
- package/lib/Common/data/List.js +28 -6
- package/lib/Common/data/ListNodeAnd.js +3 -3
- package/lib/Common/data/objectPath.d.ts +4 -0
- package/lib/Common/data/objectPath.js +8 -3
- package/lib/Common/events/Listen.d.ts +38 -5
- package/lib/Common/events/Listen.js +89 -54
- package/lib/Common/events/SocketBuffer.d.ts +9 -4
- package/lib/Common/events/SocketBuffer.js +1 -0
- package/lib/Common/events/SocketServerHook.d.ts +20 -7
- package/lib/Common/events/SocketServerHook.js +2 -1
- package/lib/Common/events/UseListenTransform.d.ts +8 -3
- package/lib/Common/events/event.d.ts +12 -0
- package/lib/Common/events/event.js +27 -12
- package/lib/Common/events/joinListens.d.ts +2 -0
- package/lib/Common/events/joinListens.js +20 -12
- package/lib/Common/funcTimeWait.d.ts +28 -2
- package/lib/Common/funcTimeWait.js +20 -21
- package/lib/Common/id-pool.js +12 -2
- package/lib/Common/inputAutoStep.js +2 -2
- package/lib/Common/isProxy.d.ts +1 -0
- package/lib/Common/isProxy.js +2 -0
- package/lib/Common/math/Math.d.ts +1 -0
- package/lib/Common/math/Math.js +7 -1
- package/lib/Common/math/other.js +2 -1
- package/lib/Common/math/scoreLana.js +3 -2
- package/lib/Common/node_console.d.ts +2 -0
- package/lib/Common/node_console.js +3 -76
- package/lib/Common/rcp/createRpcServerAutoWithProtocolDetection.d.ts +2 -0
- package/lib/Common/rcp/createRpcServerAutoWithProtocolDetection.js +63 -30
- package/lib/Common/rcp/listen-deep.d.ts +13 -5
- package/lib/Common/rcp/listen-deep.js +1 -6
- package/lib/Common/rcp/listen-socket.d.ts +21 -3
- package/lib/Common/rcp/listen-socket.js +97 -6
- package/lib/Common/rcp/oldCommonsServer.d.ts +1 -1
- package/lib/Common/rcp/oldCommonsServer.js +15 -1
- package/lib/Common/rcp/old/320/241ommonsServerMini.js +1 -0
- package/lib/Common/rcp/rpc-caps.d.ts +10 -0
- package/lib/Common/rcp/rpc-caps.js +16 -0
- package/lib/Common/rcp/rpc-client.d.ts +23 -1
- package/lib/Common/rcp/rpc-client.js +306 -25
- package/lib/Common/rcp/rpc-clientHub.d.ts +7 -1
- package/lib/Common/rcp/rpc-clientHub.js +25 -2
- package/lib/Common/rcp/rpc-index.d.ts +3 -0
- package/lib/Common/rcp/rpc-index.js +3 -0
- package/lib/Common/rcp/rpc-inproc.d.ts +17 -0
- package/lib/Common/rcp/rpc-inproc.js +30 -0
- package/lib/Common/rcp/rpc-off.d.ts +10 -0
- package/lib/Common/rcp/rpc-off.js +22 -0
- package/lib/Common/rcp/rpc-protocol.d.ts +6 -0
- package/lib/Common/rcp/rpc-protocol.js +4 -2
- package/lib/Common/rcp/rpc-server-auto.d.ts +14 -3
- package/lib/Common/rcp/rpc-server-auto.js +81 -6
- package/lib/Common/rcp/rpc-server.d.ts +17 -2
- package/lib/Common/rcp/rpc-server.js +127 -31
- package/lib/Common/rcp/rpc-shape.d.ts +17 -0
- package/lib/Common/rcp/rpc-shape.js +42 -0
- package/lib/Common/rcp/rpc-walk.js +29 -11
- package/lib/Common/rcp/test.d.ts +1 -0
- package/lib/Common/rcp/test.js +78 -0
- package/lib/Exchange/Bars.d.ts +3 -0
- package/lib/Exchange/Bars.js +9 -4
- package/lib/Exchange/CParams.d.ts +2 -0
- package/lib/Exchange/CParams.js +22 -15
- package/lib/Exchange/MarketData.d.ts +6 -0
- package/lib/Exchange/MarketData.js +5 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/server/WebHook3.d.ts +1 -0
- package/lib/server/WebHook3.js +45 -16
- package/lib/server/fsKeyVolume.js +20 -3
- package/lib/toError/myThrow.d.ts +20 -1
- package/lib/toError/myThrow.js +32 -19
- package/package.json +2 -1
- package/lib/Common/Error/myThrow.d.ts +0 -5
- package/lib/Common/Error/myThrow.js +0 -23
|
@@ -1,51 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enhancedWaitRun =
|
|
3
|
+
exports.createTaskQueue = exports.enhancedWaitRun = void 0;
|
|
4
|
+
exports.createThrottle = createThrottle;
|
|
4
5
|
exports.createAsyncQueue = createAsyncQueue;
|
|
5
6
|
exports.enhancedQueueRun = enhancedQueueRun;
|
|
6
7
|
exports.waitRun = waitRun;
|
|
7
8
|
exports.queueRun = queueRun;
|
|
8
|
-
exports.
|
|
9
|
+
exports.createReadyGate = createReadyGate;
|
|
9
10
|
const common_1 = require("../core/common");
|
|
10
|
-
function
|
|
11
|
+
function createThrottle() {
|
|
11
12
|
let last = 0, busy = false, pending;
|
|
12
13
|
let chain = Promise.resolve();
|
|
14
|
+
const throttle = (ms, func) => {
|
|
15
|
+
if (busy || last + ms >= Date.now())
|
|
16
|
+
return;
|
|
17
|
+
busy = true;
|
|
18
|
+
chain = chain.catch(() => { }).then(async () => {
|
|
19
|
+
try {
|
|
20
|
+
return await func();
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
busy = false;
|
|
24
|
+
last = Date.now();
|
|
25
|
+
}
|
|
26
|
+
}).catch(() => { });
|
|
27
|
+
};
|
|
28
|
+
const debounce = (ms, func) => {
|
|
29
|
+
if (!func)
|
|
30
|
+
throw new Error("debounceAsync: func is undefined");
|
|
31
|
+
pending = func;
|
|
32
|
+
if (busy)
|
|
33
|
+
return chain;
|
|
34
|
+
busy = true;
|
|
35
|
+
return chain = chain.finally(async () => {
|
|
36
|
+
try {
|
|
37
|
+
await (0, common_1.sleepAsync)(ms);
|
|
38
|
+
await pending?.();
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
busy = false;
|
|
42
|
+
chain = Promise.resolve();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
13
46
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
chain = chain.then(async () => {
|
|
19
|
-
try {
|
|
20
|
-
return await func();
|
|
21
|
-
}
|
|
22
|
-
finally {
|
|
23
|
-
busy = false;
|
|
24
|
-
last = Date.now();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
debounceAsync: (ms, func) => {
|
|
29
|
-
if (!func)
|
|
30
|
-
throw new Error("debounceAsync: func is undefined");
|
|
31
|
-
pending = func;
|
|
32
|
-
if (busy)
|
|
33
|
-
return chain;
|
|
34
|
-
busy = true;
|
|
35
|
-
return chain = chain.finally(async () => {
|
|
36
|
-
try {
|
|
37
|
-
await (0, common_1.sleepAsync)(ms);
|
|
38
|
-
await pending?.();
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
busy = false;
|
|
42
|
-
chain = Promise.resolve();
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
},
|
|
47
|
+
throttle,
|
|
48
|
+
debounce,
|
|
49
|
+
throttleAsync: throttle,
|
|
50
|
+
debounceAsync: debounce,
|
|
46
51
|
};
|
|
47
52
|
}
|
|
53
|
+
exports.enhancedWaitRun = createThrottle;
|
|
48
54
|
function createAsyncQueue(concurrency = 1) {
|
|
55
|
+
if (concurrency < 1)
|
|
56
|
+
throw new Error("createAsyncQueue: concurrency must be >= 1");
|
|
49
57
|
const queue = [];
|
|
50
58
|
let active = 0, resolveIdle = null, idle = null;
|
|
51
59
|
const drain = () => {
|
|
@@ -67,19 +75,25 @@ function createAsyncQueue(concurrency = 1) {
|
|
|
67
75
|
} }); drain(); });
|
|
68
76
|
const onIdle = () => idle ??= new Promise(r => (active === 0 && !queue.length) ? r() : (resolveIdle = r));
|
|
69
77
|
const getQueueSize = () => queue.length;
|
|
70
|
-
return {
|
|
78
|
+
return {
|
|
79
|
+
add: enqueue,
|
|
80
|
+
onIdle,
|
|
81
|
+
get size() { return queue.length; },
|
|
82
|
+
enqueue,
|
|
83
|
+
getQueueSize,
|
|
84
|
+
};
|
|
71
85
|
}
|
|
72
86
|
function enhancedQueueRun(maxParallelTasks = 5) {
|
|
73
87
|
const q = createAsyncQueue(maxParallelTasks);
|
|
74
88
|
return {
|
|
75
89
|
get queueSize() { return q.getQueueSize(); },
|
|
76
|
-
enqueue: (task) => { q.enqueue(task); },
|
|
77
|
-
enqueueAndRun: (task) =>
|
|
90
|
+
enqueue: (task) => { q.enqueue(task).catch(() => { }); },
|
|
91
|
+
enqueueAndRun: (task) => q.enqueue(task),
|
|
78
92
|
runAll: () => q.onIdle(),
|
|
79
93
|
};
|
|
80
94
|
}
|
|
81
95
|
function waitRun() {
|
|
82
|
-
const w = enhancedWaitRun();
|
|
96
|
+
const w = (0, exports.enhancedWaitRun)();
|
|
83
97
|
return { refreshAsync: w.throttleAsync, refreshAsync2: w.debounceAsync };
|
|
84
98
|
}
|
|
85
99
|
function queueRun(n = 5) {
|
|
@@ -91,14 +105,30 @@ function queueRun(n = 5) {
|
|
|
91
105
|
run: () => q.runAll(),
|
|
92
106
|
};
|
|
93
107
|
}
|
|
94
|
-
function
|
|
95
|
-
let
|
|
108
|
+
function createReadyGate() {
|
|
109
|
+
let isReadyFlag = false;
|
|
96
110
|
const tasks = [];
|
|
111
|
+
const setReady = async () => {
|
|
112
|
+
isReadyFlag = true;
|
|
113
|
+
const run = tasks.splice(0);
|
|
114
|
+
let err;
|
|
115
|
+
for (const fn of run) {
|
|
116
|
+
try {
|
|
117
|
+
await fn();
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
err ??= e;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (err !== undefined)
|
|
124
|
+
throw err;
|
|
125
|
+
};
|
|
97
126
|
return {
|
|
98
|
-
add: (fn) =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
isReady: () => ready,
|
|
127
|
+
add: (fn) => isReadyFlag ? void fn() : tasks.push(fn),
|
|
128
|
+
ready: setReady,
|
|
129
|
+
isReady: () => isReadyFlag,
|
|
102
130
|
tasks: () => [...tasks],
|
|
131
|
+
setReady,
|
|
103
132
|
};
|
|
104
133
|
}
|
|
134
|
+
exports.createTaskQueue = createReadyGate;
|
|
@@ -11,6 +11,7 @@ type AsyncExtras<T extends (...args: any[]) => any> = ReturnType<T> extends Prom
|
|
|
11
11
|
} : {};
|
|
12
12
|
type EnhancedDecoratorOptions<T extends (...args: any[]) => any> = CommonOptions<T> & AsyncExtras<T>;
|
|
13
13
|
export declare function enhancedDecorator<T extends (...args: any[]) => any>(fn: T, opt?: EnhancedDecoratorOptions<T>): (...args: Parameters<T>) => ReturnType<T>;
|
|
14
|
+
export declare const wrap: typeof enhancedDecorator;
|
|
14
15
|
export declare function enhancedTransformer<T extends (...args: any[]) => any, R>(fn: T, transform: (data: [args: Parameters<T>, result: ReturnType<T>]) => R): (...args: Parameters<T>) => R;
|
|
15
16
|
export declare function Decorator<T extends (...args: any[]) => any>(fn: T, opt?: {
|
|
16
17
|
parameters?: (...a: Parameters<T>) => any;
|
|
@@ -20,5 +21,6 @@ export declare function Decorator<T extends (...args: any[]) => any>(fn: T, opt?
|
|
|
20
21
|
resultModifier?: (res: ReturnType<T>) => ReturnType<T>;
|
|
21
22
|
}): (...args: Parameters<T>) => ReturnType<T>;
|
|
22
23
|
export declare function TransformerResult<T extends (...args: any[]) => any, R>(fn: T, transform: (data: [args: Parameters<T>, result: ReturnType<T>]) => R): (...args: Parameters<T>) => R;
|
|
23
|
-
export declare function
|
|
24
|
+
export declare function around<T extends (...args: any[]) => any, R>(fn: T, transform: (data: [args: Parameters<T>, fn: T]) => R): (...args: Parameters<T>) => R;
|
|
25
|
+
export declare const Transformer: typeof around;
|
|
24
26
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Transformer = exports.wrap = void 0;
|
|
3
4
|
exports.enhancedDecorator = enhancedDecorator;
|
|
4
5
|
exports.enhancedTransformer = enhancedTransformer;
|
|
5
6
|
exports.Decorator = Decorator;
|
|
6
7
|
exports.TransformerResult = TransformerResult;
|
|
7
|
-
exports.
|
|
8
|
+
exports.around = around;
|
|
8
9
|
function enhancedDecorator(fn, opt) {
|
|
9
10
|
return (...args) => {
|
|
10
11
|
opt?.beforeParams?.(...args);
|
|
@@ -20,15 +21,17 @@ function enhancedDecorator(fn, opt) {
|
|
|
20
21
|
})
|
|
21
22
|
.catch((err) => {
|
|
22
23
|
optAsync?.onCatch?.(err);
|
|
24
|
+
throw err;
|
|
23
25
|
})
|
|
24
26
|
.finally(() => optAsync?.onFinally?.());
|
|
25
27
|
}
|
|
26
28
|
else {
|
|
27
29
|
opt?.onResult?.(rawResult);
|
|
28
|
-
return opt?.modifyResult?.(rawResult)
|
|
30
|
+
return opt?.modifyResult?.(rawResult) ?? rawResult;
|
|
29
31
|
}
|
|
30
32
|
};
|
|
31
33
|
}
|
|
34
|
+
exports.wrap = enhancedDecorator;
|
|
32
35
|
function enhancedTransformer(fn, transform) {
|
|
33
36
|
return (...args) => {
|
|
34
37
|
const result = fn(...args);
|
|
@@ -47,6 +50,7 @@ function Decorator(fn, opt) {
|
|
|
47
50
|
function TransformerResult(fn, transform) {
|
|
48
51
|
return enhancedTransformer(fn, transform);
|
|
49
52
|
}
|
|
50
|
-
function
|
|
53
|
+
function around(fn, transform) {
|
|
51
54
|
return (...args) => transform([args, fn]);
|
|
52
55
|
}
|
|
56
|
+
exports.Transformer = around;
|
|
@@ -24,6 +24,8 @@ function DeepCompareKeys2(obj1, keys, func) {
|
|
|
24
24
|
return obj1;
|
|
25
25
|
if (CompareKeys2(obj1, keys))
|
|
26
26
|
return func(obj1);
|
|
27
|
+
if (Array.isArray(obj1))
|
|
28
|
+
return obj1.map((v) => DeepCompareKeys2(v, keys, func));
|
|
27
29
|
return Object.fromEntries(Object.entries(obj1).map(([k, v]) => [k, DeepCompareKeys2(v, keys, func)]));
|
|
28
30
|
}
|
|
29
31
|
function DeepCompareKeys(obj1, obj2, func) {
|
|
@@ -32,5 +34,7 @@ function DeepCompareKeys(obj1, obj2, func) {
|
|
|
32
34
|
const keys = Object.keys(obj2);
|
|
33
35
|
if (CompareKeys2(obj1, keys))
|
|
34
36
|
return func(obj1);
|
|
37
|
+
if (Array.isArray(obj1))
|
|
38
|
+
return obj1.map((v) => DeepCompareKeys2(v, keys, func));
|
|
35
39
|
return Object.fromEntries(Object.entries(obj1).map(([k, v]) => [k, DeepCompareKeys2(v, keys, func)]));
|
|
36
40
|
}
|
|
@@ -16,7 +16,7 @@ function MemoFunc(a) {
|
|
|
16
16
|
eventUpdate?.();
|
|
17
17
|
}
|
|
18
18
|
function evictOldest(map) {
|
|
19
|
-
const keep = Math.floor(maxLimits / 2);
|
|
19
|
+
const keep = Math.max(1, Math.floor(maxLimits / 2));
|
|
20
20
|
const entries = [...map.entries()].sort((a, b) => a[1].time - b[1].time);
|
|
21
21
|
const toRemove = entries.slice(0, entries.length - keep);
|
|
22
22
|
for (const [key] of toRemove) {
|
|
@@ -25,7 +25,7 @@ function MemoFunc(a) {
|
|
|
25
25
|
eventUpdate?.();
|
|
26
26
|
}
|
|
27
27
|
function evictOldestFuncs() {
|
|
28
|
-
const keep = Math.floor(maxLimits / 2);
|
|
28
|
+
const keep = Math.max(1, Math.floor(maxLimits / 2));
|
|
29
29
|
const entries = [...memo.entries()].sort((a, b) => {
|
|
30
30
|
const maxTimeA = Math.max(...[...a[1].values()].map(e => e.time ?? 0));
|
|
31
31
|
const maxTimeB = Math.max(...[...b[1].values()].map(e => e.time ?? 0));
|
|
@@ -7,16 +7,16 @@ type const_Date = Omit<Date, "setTime" | "setFullYear" | "setMonth" | "setDate"
|
|
|
7
7
|
export declare function isDate<T>(value: T & (Extract<T, const_Date> extends never ? never : T)): value is Extract<typeof value, const_Date>;
|
|
8
8
|
export { Mutable };
|
|
9
9
|
export declare function shallowClone<T>(val: T): Mutable<T>;
|
|
10
|
-
export declare function _deepClone<T>(src: T, map?: Map<object, object>):
|
|
11
|
-
export declare function deepClone<T>(object: T):
|
|
10
|
+
export declare function _deepClone<T>(src: T, map?: Map<object, object>): any;
|
|
11
|
+
export declare function deepClone<T>(object: T): any;
|
|
12
|
+
export declare const clone: typeof deepClone;
|
|
12
13
|
export declare function deepCloneMutable<T>(value: T): MutableFull<T>;
|
|
13
|
-
export declare function deepCloneObject<T extends object>(object: T):
|
|
14
|
+
export declare function deepCloneObject<T extends object>(object: T): any;
|
|
14
15
|
export declare function deepCloneObjectMutable<T extends object>(object: T): MutableFull<T>;
|
|
15
16
|
export declare function toImmutable<T extends object>(object: T): Immutable<T>;
|
|
16
17
|
export declare function readonlyFull<T>(arg: T): ReadonlyFull<T>;
|
|
17
|
-
export declare function deepEqual
|
|
18
|
-
|
|
19
|
-
}>(object1: T, object2: T): boolean;
|
|
18
|
+
export declare function deepEqual(object1: any, object2: any): boolean;
|
|
19
|
+
export declare const isEqual: typeof deepEqual;
|
|
20
20
|
export declare function shallowEqual<T extends {
|
|
21
21
|
[key: string]: unknown;
|
|
22
22
|
} | undefined>(object1: T, object2: T): boolean;
|
|
@@ -57,21 +57,28 @@ export declare function BSearchNearest(array: ArrayLike<number>, searchValue: nu
|
|
|
57
57
|
export declare function BSearchNearest<T>(array: ArrayLike<T>, searchValue: number, arrayGetValue: (element: T) => number, maxDelta?: number): number;
|
|
58
58
|
export declare function _BSearchNearest<T>(array: ArrayLike<T>, searchValue: number, arrayGetValue: (element: T) => number, maxDelta?: number): number;
|
|
59
59
|
export declare function NormalizeDouble(value: number, digits: number): number;
|
|
60
|
+
export declare function round(value: number, digits?: number): number;
|
|
60
61
|
export declare function MaxCommonDivisor(a: number, b: number, digits?: number): number;
|
|
61
62
|
export declare function MaxCommonDivisorOnArray(values: Iterable<number>, precisDigits?: number): number;
|
|
63
|
+
export declare function gcd(a: number, b: number, digits?: number): number;
|
|
64
|
+
export declare function gcd(values: Iterable<number>, digits?: number): number;
|
|
62
65
|
export declare function GetDblPrecision2(value: number, mindigits: number, maxdigits: number): number;
|
|
63
66
|
export declare function GetDblPrecision(value: number, maxdigits?: number): number;
|
|
67
|
+
export declare function decimals(value: number, maxDigits?: number, minDigits?: number): number;
|
|
64
68
|
export declare function DblToStrAuto(value: number, maxprecis?: number): string;
|
|
69
|
+
export declare const formatAuto: typeof DblToStrAuto;
|
|
65
70
|
export declare function NormalizeDoubleAnd(a: number, options?: {
|
|
66
71
|
digitsPoint?: number;
|
|
67
72
|
digitsR?: number;
|
|
68
73
|
type?: "max" | "min";
|
|
69
74
|
}): number;
|
|
75
|
+
export declare const roundSig: typeof NormalizeDoubleAnd;
|
|
70
76
|
export declare function DblToStrAnd(a: number, options?: {
|
|
71
77
|
digitsPoint?: number;
|
|
72
78
|
digitsR?: number;
|
|
73
79
|
type?: "max" | "min";
|
|
74
80
|
}): string;
|
|
81
|
+
export declare const formatSig: typeof DblToStrAnd;
|
|
75
82
|
export declare function ArrayItemHandler<T extends {
|
|
76
83
|
[key: number]: any;
|
|
77
84
|
}>(getter: (target: T, i: number) => T[number], setter?: (target: T, i: number, value: T[number]) => void): ProxyHandler<T>;
|
|
@@ -113,17 +120,25 @@ export declare class __MyMap<K extends {
|
|
|
113
120
|
get sortedKeys(): readonly K[];
|
|
114
121
|
get Values(): readonly V[];
|
|
115
122
|
assign(other: __MyMap<K, V>): void;
|
|
123
|
+
set(key: K, value: V): void;
|
|
124
|
+
get(key: K): V | undefined;
|
|
125
|
+
has(key: K): boolean;
|
|
126
|
+
delete(key: K): void;
|
|
127
|
+
clear(): void;
|
|
128
|
+
get size(): number;
|
|
116
129
|
}
|
|
117
130
|
export declare class MyMap<K extends {
|
|
118
131
|
valueOf(): number;
|
|
119
132
|
}, V> extends __MyMap<K, V> {
|
|
120
133
|
readonly [key: number]: void;
|
|
121
134
|
Clone(): MyMap<K, V>;
|
|
135
|
+
clone(): MyMap<K, V>;
|
|
122
136
|
}
|
|
123
137
|
export declare class MyNumMap<VAL> extends __MyMap<number, VAL> {
|
|
124
138
|
[key: number]: VAL | undefined;
|
|
125
139
|
constructor();
|
|
126
140
|
Clone(): MyNumMap<VAL>;
|
|
141
|
+
clone(): MyNumMap<VAL>;
|
|
127
142
|
}
|
|
128
143
|
export declare class StructMap<TKey extends (Required<TKey> & {
|
|
129
144
|
[key: string]: number | string;
|
|
@@ -187,9 +202,10 @@ export declare class CancelToken implements ICancelToken {
|
|
|
187
202
|
private _cancel;
|
|
188
203
|
isCancelled(): boolean;
|
|
189
204
|
cancel(): void;
|
|
205
|
+
get aborted(): boolean;
|
|
206
|
+
abort(): void;
|
|
190
207
|
}
|
|
191
208
|
export declare class CancelablePromise<T> extends Promise<T> {
|
|
192
|
-
private static _rejectTmp;
|
|
193
209
|
private readonly _reject?;
|
|
194
210
|
private readonly _onCancel?;
|
|
195
211
|
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, onCancel?: () => void);
|
|
@@ -209,6 +225,7 @@ export declare class Mutex {
|
|
|
209
225
|
private mutex;
|
|
210
226
|
lock(): PromiseLike<() => void>;
|
|
211
227
|
dispatch<T>(fn: () => T | PromiseLike<T>): Promise<T>;
|
|
228
|
+
runExclusive<T>(fn: () => T | PromiseLike<T>): Promise<T>;
|
|
212
229
|
static createLock(): PromiseLike<() => void>;
|
|
213
230
|
}
|
|
214
231
|
export declare function copyToClipboard(textToCopy: string): Promise<any>;
|
|
@@ -232,6 +249,7 @@ export declare class MapExt<K, V> extends Map<K, V> {
|
|
|
232
249
|
private immutArray?;
|
|
233
250
|
set(key: K, value: V): this;
|
|
234
251
|
delete(key: K): boolean;
|
|
252
|
+
clear(): void;
|
|
235
253
|
valuesArrayImmutable(): readonly V[];
|
|
236
254
|
getOrSetFunc(key: K, val: () => V): V;
|
|
237
255
|
getOrSet(key: K, val: V): V;
|