@minto-ai/tools 1.0.1 → 1.0.2
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.js +10 -1
- package/dist/supply/index.d.ts +2 -1
- package/dist/supply/time-delay.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -123,6 +123,14 @@ function pickObject(obj, keys) {
|
|
|
123
123
|
function getUuid() {
|
|
124
124
|
return window.crypto.getRandomValues(new Uint32Array(1))[0].toString(36);
|
|
125
125
|
}
|
|
126
|
+
function timeDelay(delay) {
|
|
127
|
+
if (typeof delay !== "number" || delay < 0) {
|
|
128
|
+
throw new Error("延迟时间必须是非负数");
|
|
129
|
+
}
|
|
130
|
+
return new Promise((resolve) => {
|
|
131
|
+
setTimeout(resolve, delay);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
126
134
|
function createWebSocket(url) {
|
|
127
135
|
return new WebSocket(url);
|
|
128
136
|
}
|
|
@@ -543,5 +551,6 @@ export {
|
|
|
543
551
|
pickObject,
|
|
544
552
|
singleDownloadFile,
|
|
545
553
|
subtract,
|
|
546
|
-
throttle
|
|
554
|
+
throttle,
|
|
555
|
+
timeDelay
|
|
547
556
|
};
|
package/dist/supply/index.d.ts
CHANGED