mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
Co-authored-by: enisdenjo <badurinadenis@gmail.com> Co-authored-by: Denis Badurina <denis@domonda.com>
34 lines
1.1 KiB
Diff
34 lines
1.1 KiB
Diff
diff --git a/index.js b/index.js
|
|
index fbfc8b2..6169638 100644
|
|
--- a/index.js
|
|
+++ b/index.js
|
|
@@ -5,7 +5,7 @@
|
|
if (typeof SharedArrayBuffer !== 'undefined' && typeof Atomics !== 'undefined') {
|
|
const nil = new Int32Array(new SharedArrayBuffer(4))
|
|
|
|
- function sleep (ms) {
|
|
+ function atomicSleep1 (ms) {
|
|
// also filters out NaN, non-number types, including empty strings, but allows bigints
|
|
const valid = ms > 0 && ms < Infinity
|
|
if (valid === false) {
|
|
@@ -17,10 +17,10 @@ if (typeof SharedArrayBuffer !== 'undefined' && typeof Atomics !== 'undefined')
|
|
|
|
Atomics.wait(nil, 0, 0, Number(ms))
|
|
}
|
|
- module.exports = sleep
|
|
+ module.exports = atomicSleep1
|
|
} else {
|
|
|
|
- function sleep (ms) {
|
|
+ function atomicSleep2 (ms) {
|
|
// also filters out NaN, non-number types, including empty strings, but allows bigints
|
|
const valid = ms > 0 && ms < Infinity
|
|
if (valid === false) {
|
|
@@ -33,6 +33,6 @@ if (typeof SharedArrayBuffer !== 'undefined' && typeof Atomics !== 'undefined')
|
|
while (target > Date.now()){}
|
|
}
|
|
|
|
- module.exports = sleep
|
|
+ module.exports = atomicSleep2
|
|
|
|
}
|