@peerbit/time 2.0.6 → 2.0.7-55cebfe
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/LICENSE +0 -2
- package/dist/src/hrtime.browser.d.ts +6 -0
- package/dist/src/hrtime.browser.d.ts.map +1 -0
- package/{lib/esm/hrtime.js → dist/src/hrtime.browser.js} +5 -28
- package/dist/src/hrtime.browser.js.map +1 -0
- package/dist/src/hrtime.d.ts +3 -0
- package/dist/src/hrtime.d.ts.map +1 -0
- package/dist/src/hrtime.js +3 -0
- package/dist/src/hrtime.js.map +1 -0
- package/{lib/esm → dist/src}/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -0
- package/{lib/esm → dist/src}/index.js +1 -1
- package/dist/src/index.js.map +1 -0
- package/{lib/esm → dist/src}/metrics.d.ts +1 -0
- package/dist/src/metrics.d.ts.map +1 -0
- package/{lib/esm → dist/src}/metrics.js +3 -3
- package/dist/src/metrics.js.map +1 -0
- package/{lib/esm → dist/src}/wait.d.ts +1 -2
- package/dist/src/wait.d.ts.map +1 -0
- package/{lib/esm → dist/src}/wait.js +11 -15
- package/dist/src/wait.js.map +1 -0
- package/package.json +60 -31
- package/src/hrtime.browser.ts +50 -0
- package/src/hrtime.ts +2 -78
- package/src/index.ts +2 -1
- package/src/metrics.ts +4 -3
- package/src/wait.ts +18 -22
- package/lib/esm/hrtime.d.ts +0 -5
- package/lib/esm/hrtime.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/metrics.js.map +0 -1
- package/lib/esm/wait.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.browser.d.ts","sourceRoot":"","sources":["../../src/hrtime.browser.ts"],"names":[],"mappings":"AA2BA,QAAA,MAAM,MAAM;yBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;kBAiB/C,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;CAFhD,CAAC;AAOF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -24,27 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
24
24
|
SOFTWARE.
|
|
25
25
|
|
|
26
26
|
*/
|
|
27
|
-
const
|
|
28
|
-
// based on https://gist.github.com/paulirish/5438650 copyright Paul Irish 2015.
|
|
29
|
-
if ("performance" in window === false) {
|
|
30
|
-
window.performance = {};
|
|
31
|
-
}
|
|
32
|
-
Date.now =
|
|
33
|
-
Date.now ||
|
|
34
|
-
(() => {
|
|
35
|
-
// thanks IE8
|
|
36
|
-
return new Date().getTime();
|
|
37
|
-
});
|
|
38
|
-
if ("now" in window.performance === false) {
|
|
39
|
-
let nowOffset = Date.now();
|
|
40
|
-
if (performance.timeOrigin) {
|
|
41
|
-
nowOffset = performance.timeOrigin;
|
|
42
|
-
}
|
|
43
|
-
window.performance["now"] = () => Date.now() - nowOffset;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const _hrtime = (previousTimestamp) => {
|
|
47
|
-
_perfomancePolyfill();
|
|
27
|
+
const hrtime = (previousTimestamp) => {
|
|
48
28
|
const baseNow = Math.floor((Date.now() - performance.now()) * 1e-3);
|
|
49
29
|
const clocktime = performance.now() * 1e-3;
|
|
50
30
|
let seconds = Math.floor(clocktime) + baseNow;
|
|
@@ -60,12 +40,9 @@ const _hrtime = (previousTimestamp) => {
|
|
|
60
40
|
return [seconds, nanoseconds];
|
|
61
41
|
};
|
|
62
42
|
const NS_PER_SEC = 1e9;
|
|
63
|
-
|
|
64
|
-
const diff =
|
|
43
|
+
hrtime.bigint = (time) => {
|
|
44
|
+
const diff = hrtime(time);
|
|
65
45
|
return BigInt(diff[0] * NS_PER_SEC + diff[1]);
|
|
66
46
|
};
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
? _hrtime
|
|
70
|
-
: process.hrtime;
|
|
71
|
-
//# sourceMappingURL=hrtime.js.map
|
|
47
|
+
export { hrtime };
|
|
48
|
+
//# sourceMappingURL=hrtime.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.browser.js","sourceRoot":"","sources":["../../src/hrtime.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyBE;AAEF,MAAM,MAAM,GAAG,CAAC,iBAAoC,EAAoB,EAAE;IACzE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3C,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;IAC9C,IAAI,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAEpD,IAAI,iBAAiB,EAAE,CAAC;QACvB,OAAO,GAAG,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACzC,WAAW,GAAG,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;YACV,WAAW,IAAI,GAAG,CAAC;QACpB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,CAAC,MAAM,GAAG,CAAC,IAAuB,EAAU,EAAE;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.d.ts","sourceRoot":"","sources":["../../src/hrtime.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,eAAiB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrtime.js","sourceRoot":"","sources":["../../src/hrtime.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAKpB,QAAQ,CAAC,GAAG;IAJxB,OAAO,CAAC,MAAM,CAAS;IAEvB,KAAK,SAAK;gBAEW,GAAG,SAAK;IAI7B,GAAG,CAAC,MAAM,EAAE,MAAM;CAWlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import hrtime from "./hrtime.js";
|
|
1
|
+
import { hrtime } from "./hrtime.js";
|
|
2
2
|
export class MovingAverageTracker {
|
|
3
3
|
tau;
|
|
4
4
|
lastTS;
|
|
@@ -15,8 +15,8 @@ export class MovingAverageTracker {
|
|
|
15
15
|
}
|
|
16
16
|
const dt = diff / 1e9;
|
|
17
17
|
this.lastTS = now;
|
|
18
|
-
const
|
|
19
|
-
this.value = (1 -
|
|
18
|
+
const alphaT = 1 - Math.exp(-dt / this.tau);
|
|
19
|
+
this.value = (1 - alphaT) * this.value + (alphaT * number) / dt;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,oBAAoB;IAKX;IAJb,MAAM,CAAS;IAEvB,KAAK,GAAG,CAAC,CAAC;IAEV,YAAqB,MAAM,EAAE;QAAR,QAAG,GAAH,GAAG,CAAK;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,GAAG,CAAC,MAAc;QACjB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACf,IAAI,GAAG,CAAC,CAAC,CAAC,oCAAoC;QAC/C,CAAC;QACD,MAAM,EAAE,GAAG,IAAI,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;IACjE,CAAC;CACD"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare class TimeoutError extends Error {
|
|
2
|
-
constructor(message?: string);
|
|
3
2
|
}
|
|
4
3
|
export declare class AbortError extends Error {
|
|
5
|
-
constructor(message?: string);
|
|
6
4
|
}
|
|
7
5
|
export declare const delay: (ms: number, options?: {
|
|
8
6
|
signal?: AbortSignal;
|
|
@@ -19,3 +17,4 @@ export declare const waitForResolved: <T>(fn: () => T | Promise<T>, options?: {
|
|
|
19
17
|
delayInterval?: number;
|
|
20
18
|
timeoutMessage?: string;
|
|
21
19
|
}) => Promise<T>;
|
|
20
|
+
//# sourceMappingURL=wait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait.d.ts","sourceRoot":"","sources":["../../src/wait.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C,qBAAa,UAAW,SAAQ,KAAK;CAAG;AACxC,eAAO,MAAM,KAAK,OAAc,MAAM,YAAY;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,kBAYzE,CAAC;AASF,eAAO,MAAM,OAAO,GAAU,CAAC,MAC1B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,YACf;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,KACC,OAAO,CAAC,CAAC,GAAG,SAAS,CAwBvB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,CAAC,MAClC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,YACf;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,KACC,OAAO,CAAC,CAAC,CAgCX,CAAC"}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
export class TimeoutError extends Error {
|
|
2
|
-
constructor(message) {
|
|
3
|
-
super(message);
|
|
4
|
-
}
|
|
5
2
|
}
|
|
6
3
|
export class AbortError extends Error {
|
|
7
|
-
constructor(message) {
|
|
8
|
-
super(message);
|
|
9
|
-
}
|
|
10
4
|
}
|
|
11
|
-
export const delay = (ms, options) => {
|
|
12
|
-
return new Promise((
|
|
5
|
+
export const delay = async (ms, options) => {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
13
7
|
function handleAbort() {
|
|
14
8
|
clearTimeout(timer);
|
|
15
|
-
|
|
9
|
+
reject(new AbortError());
|
|
16
10
|
}
|
|
17
11
|
options?.signal?.addEventListener("abort", handleAbort);
|
|
18
12
|
const timer = setTimeout(() => {
|
|
19
13
|
options?.signal?.removeEventListener("abort", handleAbort);
|
|
20
|
-
|
|
14
|
+
resolve();
|
|
21
15
|
}, ms);
|
|
22
16
|
});
|
|
23
17
|
};
|
|
@@ -27,14 +21,15 @@ const createTimeoutError = (options) => new TimeoutError(options?.timeoutMessage
|
|
|
27
21
|
export const waitFor = async (fn, options = { timeout: 10 * 1000, delayInterval: 100 }) => {
|
|
28
22
|
const delayInterval = options.delayInterval || 100;
|
|
29
23
|
const timeout = options.timeout || 10 * 1000;
|
|
30
|
-
const startTime =
|
|
24
|
+
const startTime = Number(new Date());
|
|
31
25
|
let stop = false;
|
|
32
26
|
const handleAbort = () => {
|
|
33
27
|
stop = true;
|
|
34
28
|
options.signal?.removeEventListener("abort", handleAbort);
|
|
35
29
|
};
|
|
36
30
|
options.signal?.addEventListener("abort", handleAbort);
|
|
37
|
-
|
|
31
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
32
|
+
while (!stop && Number(new Date()) - startTime < timeout) {
|
|
38
33
|
const result = await fn();
|
|
39
34
|
if (result) {
|
|
40
35
|
options.signal?.removeEventListener("abort", handleAbort);
|
|
@@ -47,7 +42,7 @@ export const waitFor = async (fn, options = { timeout: 10 * 1000, delayInterval:
|
|
|
47
42
|
export const waitForResolved = async (fn, options = { timeout: 10 * 1000, delayInterval: 50 }) => {
|
|
48
43
|
const delayInterval = options.delayInterval || 50;
|
|
49
44
|
const timeout = options.timeout || 10 * 1000;
|
|
50
|
-
const startTime =
|
|
45
|
+
const startTime = Number(new Date());
|
|
51
46
|
let stop = false;
|
|
52
47
|
let lastError;
|
|
53
48
|
const handleAbort = () => {
|
|
@@ -55,14 +50,15 @@ export const waitForResolved = async (fn, options = { timeout: 10 * 1000, delayI
|
|
|
55
50
|
options.signal?.removeEventListener("abort", handleAbort);
|
|
56
51
|
};
|
|
57
52
|
options.signal?.addEventListener("abort", handleAbort);
|
|
58
|
-
|
|
53
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
54
|
+
while (!stop && Number(new Date()) - startTime < timeout) {
|
|
59
55
|
try {
|
|
60
56
|
const result = await fn();
|
|
61
57
|
options.signal?.removeEventListener("abort", handleAbort);
|
|
62
58
|
return result;
|
|
63
59
|
}
|
|
64
60
|
catch (error) {
|
|
65
|
-
if (error instanceof AbortError
|
|
61
|
+
if (!(error instanceof AbortError)) {
|
|
66
62
|
lastError = error;
|
|
67
63
|
}
|
|
68
64
|
else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait.js","sourceRoot":"","sources":["../../src/wait.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAa,SAAQ,KAAK;CAAG;AAE1C,MAAM,OAAO,UAAW,SAAQ,KAAK;CAAG;AACxC,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,EAAU,EAAE,OAAkC,EAAE,EAAE;IAC7E,OAA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C1D,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;YAC1B,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC1D,OAAO,MAAM,CAAC;QACf,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;gBACpC,SAAS,GAAG,KAAK,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACP,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QACD,MAAM,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,SAAS,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,33 +1,62 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"name": "@peerbit/time",
|
|
3
|
+
"version": "2.0.7-55cebfe",
|
|
4
|
+
"description": "Utility functions for time",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"*": [
|
|
11
|
+
"*",
|
|
12
|
+
"dist/*",
|
|
13
|
+
"dist/src/*",
|
|
14
|
+
"dist/src/*/index"
|
|
15
|
+
],
|
|
16
|
+
"src/*": [
|
|
17
|
+
"*",
|
|
18
|
+
"dist/*",
|
|
19
|
+
"dist/src/*",
|
|
20
|
+
"dist/src/*/index"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/test",
|
|
28
|
+
"!**/*.tsbuildinfo"
|
|
29
|
+
],
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/src/index.d.ts",
|
|
33
|
+
"import": "./dist/src/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"eslintConfig": {
|
|
37
|
+
"extends": "peerbit",
|
|
38
|
+
"parserOptions": {
|
|
39
|
+
"project": true,
|
|
40
|
+
"sourceType": "module"
|
|
41
|
+
},
|
|
42
|
+
"ignorePatterns": [
|
|
43
|
+
"!.aegir.js",
|
|
44
|
+
"test/ts-use",
|
|
45
|
+
"*.d.ts"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"browser": {
|
|
49
|
+
"./dist/src/hrtime.js": "./dist/src/hrtime.browser.js"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"clean": "aegir clean",
|
|
56
|
+
"build": "aegir build --no-bundle",
|
|
57
|
+
"test": "aegir test",
|
|
58
|
+
"lint": "aegir lint"
|
|
59
|
+
},
|
|
60
|
+
"author": "dao.xyz",
|
|
61
|
+
"license": "MIT"
|
|
33
62
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2020 Vlad Tansky
|
|
6
|
+
Copyright (c) 2022 dao.xyz
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const hrtime = (previousTimestamp?: [number, number]): [number, number] => {
|
|
29
|
+
const baseNow = Math.floor((Date.now() - performance.now()) * 1e-3);
|
|
30
|
+
const clocktime = performance.now() * 1e-3;
|
|
31
|
+
let seconds = Math.floor(clocktime) + baseNow;
|
|
32
|
+
let nanoseconds = Math.floor((clocktime % 1) * 1e9);
|
|
33
|
+
|
|
34
|
+
if (previousTimestamp) {
|
|
35
|
+
seconds = seconds - previousTimestamp[0];
|
|
36
|
+
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
37
|
+
if (nanoseconds < 0) {
|
|
38
|
+
seconds--;
|
|
39
|
+
nanoseconds += 1e9;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return [seconds, nanoseconds];
|
|
43
|
+
};
|
|
44
|
+
const NS_PER_SEC = 1e9;
|
|
45
|
+
hrtime.bigint = (time?: [number, number]): bigint => {
|
|
46
|
+
const diff = hrtime(time);
|
|
47
|
+
return BigInt(diff[0] * NS_PER_SEC + diff[1]);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { hrtime };
|
package/src/hrtime.ts
CHANGED
|
@@ -1,78 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2020 Vlad Tansky
|
|
6
|
-
Copyright (c) 2022 dao.xyz
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
SOFTWARE.
|
|
25
|
-
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const _perfomancePolyfill = () => {
|
|
29
|
-
// based on https://gist.github.com/paulirish/5438650 copyright Paul Irish 2015.
|
|
30
|
-
if ("performance" in window === false) {
|
|
31
|
-
((window as any).performance as any) = {};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
Date.now =
|
|
35
|
-
Date.now ||
|
|
36
|
-
(() => {
|
|
37
|
-
// thanks IE8
|
|
38
|
-
return new Date().getTime();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if ("now" in window.performance === false) {
|
|
42
|
-
let nowOffset = Date.now();
|
|
43
|
-
|
|
44
|
-
if (performance.timeOrigin) {
|
|
45
|
-
nowOffset = performance.timeOrigin;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
(window.performance as any)["now"] = () => Date.now() - nowOffset;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const _hrtime = (previousTimestamp?: [number, number]): [number, number] => {
|
|
53
|
-
_perfomancePolyfill();
|
|
54
|
-
const baseNow = Math.floor((Date.now() - performance.now()) * 1e-3);
|
|
55
|
-
const clocktime = performance.now() * 1e-3;
|
|
56
|
-
let seconds = Math.floor(clocktime) + baseNow;
|
|
57
|
-
let nanoseconds = Math.floor((clocktime % 1) * 1e9);
|
|
58
|
-
|
|
59
|
-
if (previousTimestamp) {
|
|
60
|
-
seconds = seconds - previousTimestamp[0];
|
|
61
|
-
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
62
|
-
if (nanoseconds < 0) {
|
|
63
|
-
seconds--;
|
|
64
|
-
nanoseconds += 1e9;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return [seconds, nanoseconds];
|
|
68
|
-
};
|
|
69
|
-
const NS_PER_SEC = 1e9;
|
|
70
|
-
_hrtime.bigint = (time?: [number, number]): bigint => {
|
|
71
|
-
const diff = _hrtime(time);
|
|
72
|
-
return BigInt(diff[0] * NS_PER_SEC + diff[1]);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default typeof process === "undefined" ||
|
|
76
|
-
typeof process.hrtime === "undefined"
|
|
77
|
-
? _hrtime
|
|
78
|
-
: process.hrtime;
|
|
1
|
+
const hrtime = process.hrtime;
|
|
2
|
+
export { hrtime };
|
package/src/index.ts
CHANGED
package/src/metrics.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import hrtime from "./hrtime.js";
|
|
1
|
+
import { hrtime } from "./hrtime.js";
|
|
2
2
|
|
|
3
3
|
export class MovingAverageTracker {
|
|
4
4
|
private lastTS: bigint;
|
|
@@ -8,6 +8,7 @@ export class MovingAverageTracker {
|
|
|
8
8
|
constructor(readonly tau = 10) {
|
|
9
9
|
this.lastTS = hrtime.bigint();
|
|
10
10
|
}
|
|
11
|
+
|
|
11
12
|
add(number: number) {
|
|
12
13
|
const now = hrtime.bigint();
|
|
13
14
|
let diff = Number(now - this.lastTS);
|
|
@@ -16,7 +17,7 @@ export class MovingAverageTracker {
|
|
|
16
17
|
}
|
|
17
18
|
const dt = diff / 1e9;
|
|
18
19
|
this.lastTS = now;
|
|
19
|
-
const
|
|
20
|
-
this.value = (1 -
|
|
20
|
+
const alphaT = 1 - Math.exp(-dt / this.tau);
|
|
21
|
+
this.value = (1 - alphaT) * this.value + (alphaT * number) / dt;
|
|
21
22
|
}
|
|
22
23
|
}
|
package/src/wait.ts
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
export class TimeoutError extends Error {
|
|
2
|
-
constructor(message?: string) {
|
|
3
|
-
super(message);
|
|
4
|
-
}
|
|
5
|
-
}
|
|
1
|
+
export class TimeoutError extends Error {}
|
|
6
2
|
|
|
7
|
-
export class AbortError extends Error {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export const delay = (ms: number, options?: { signal?: AbortSignal }) => {
|
|
13
|
-
return new Promise<void>((res, rej) => {
|
|
3
|
+
export class AbortError extends Error {}
|
|
4
|
+
export const delay = async (ms: number, options?: { signal?: AbortSignal }) => {
|
|
5
|
+
return new Promise<void>((resolve, reject) => {
|
|
14
6
|
function handleAbort() {
|
|
15
7
|
clearTimeout(timer);
|
|
16
|
-
|
|
8
|
+
reject(new AbortError());
|
|
17
9
|
}
|
|
18
10
|
options?.signal?.addEventListener("abort", handleAbort);
|
|
19
11
|
const timer = setTimeout(() => {
|
|
20
12
|
options?.signal?.removeEventListener("abort", handleAbort);
|
|
21
|
-
|
|
13
|
+
resolve();
|
|
22
14
|
}, ms);
|
|
23
15
|
});
|
|
24
16
|
};
|
|
@@ -27,7 +19,7 @@ const createTimeoutError = (options: { timeoutMessage?: string }) =>
|
|
|
27
19
|
new TimeoutError(
|
|
28
20
|
options?.timeoutMessage
|
|
29
21
|
? "Timed out: " + options?.timeoutMessage
|
|
30
|
-
: "Timed out"
|
|
22
|
+
: "Timed out",
|
|
31
23
|
);
|
|
32
24
|
|
|
33
25
|
export const waitFor = async <T>(
|
|
@@ -37,11 +29,11 @@ export const waitFor = async <T>(
|
|
|
37
29
|
signal?: AbortSignal;
|
|
38
30
|
delayInterval?: number;
|
|
39
31
|
timeoutMessage?: string;
|
|
40
|
-
} = { timeout: 10 * 1000, delayInterval: 100 }
|
|
32
|
+
} = { timeout: 10 * 1000, delayInterval: 100 },
|
|
41
33
|
): Promise<T | undefined> => {
|
|
42
34
|
const delayInterval = options.delayInterval || 100;
|
|
43
35
|
const timeout = options.timeout || 10 * 1000;
|
|
44
|
-
const startTime =
|
|
36
|
+
const startTime = Number(new Date());
|
|
45
37
|
let stop = false;
|
|
46
38
|
|
|
47
39
|
const handleAbort = () => {
|
|
@@ -50,7 +42,9 @@ export const waitFor = async <T>(
|
|
|
50
42
|
};
|
|
51
43
|
|
|
52
44
|
options.signal?.addEventListener("abort", handleAbort);
|
|
53
|
-
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
47
|
+
while (!stop && Number(new Date()) - startTime < timeout) {
|
|
54
48
|
const result = await fn();
|
|
55
49
|
if (result) {
|
|
56
50
|
options.signal?.removeEventListener("abort", handleAbort);
|
|
@@ -69,12 +63,12 @@ export const waitForResolved = async <T>(
|
|
|
69
63
|
signal?: AbortSignal;
|
|
70
64
|
delayInterval?: number;
|
|
71
65
|
timeoutMessage?: string;
|
|
72
|
-
} = { timeout: 10 * 1000, delayInterval: 50 }
|
|
66
|
+
} = { timeout: 10 * 1000, delayInterval: 50 },
|
|
73
67
|
): Promise<T> => {
|
|
74
68
|
const delayInterval = options.delayInterval || 50;
|
|
75
69
|
const timeout = options.timeout || 10 * 1000;
|
|
76
70
|
|
|
77
|
-
const startTime =
|
|
71
|
+
const startTime = Number(new Date());
|
|
78
72
|
let stop = false;
|
|
79
73
|
let lastError: Error | undefined;
|
|
80
74
|
|
|
@@ -84,13 +78,15 @@ export const waitForResolved = async <T>(
|
|
|
84
78
|
};
|
|
85
79
|
|
|
86
80
|
options.signal?.addEventListener("abort", handleAbort);
|
|
87
|
-
|
|
81
|
+
|
|
82
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
83
|
+
while (!stop && Number(new Date()) - startTime < timeout) {
|
|
88
84
|
try {
|
|
89
85
|
const result = await fn();
|
|
90
86
|
options.signal?.removeEventListener("abort", handleAbort);
|
|
91
87
|
return result;
|
|
92
88
|
} catch (error: any) {
|
|
93
|
-
if (error instanceof AbortError
|
|
89
|
+
if (!(error instanceof AbortError)) {
|
|
94
90
|
lastError = error;
|
|
95
91
|
} else {
|
|
96
92
|
throw error;
|
package/lib/esm/hrtime.d.ts
DELETED
package/lib/esm/hrtime.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hrtime.js","sourceRoot":"","sources":["../../src/hrtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyBE;AAEF,MAAM,mBAAmB,GAAG,GAAG,EAAE;IAChC,gFAAgF;IAChF,IAAI,aAAa,IAAI,MAAM,KA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AI,WAAW,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;YACV,WAAW,IAAI,GAAG,CAAC;QACpB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,OAAO,CAAC,MAAM,GAAG,CAAC,IAAuB,EAAU,EAAE;IACpD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,eAAe,OAAO,OAAO,KAAK,WAAW;IAC7C,OAAO,OAAO,CAAC,MAAM,KAAK,WAAW;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC"}
|
package/lib/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/lib/esm/metrics.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,OAAO,oBAAoB;IAKX;IAJb,MAAM,CAAS;IAEvB,KAAK,GAAG,CAAC,CAAC;IAEV,YAAqB,MAAM,EAAE;QAAR,QAAG,GAAH,GAAG,CAAK;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IACD,GAAG,CAAC,MAAc;QACjB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