console/patches/atomic-sleep@1.0.0.patch
Dimitri POSTOLOV 12ceda69dc
Use pnpm instead of yarn (#477)
Co-authored-by: enisdenjo <badurinadenis@gmail.com>
Co-authored-by: Denis Badurina <denis@domonda.com>
2022-11-01 02:11:53 +02:00

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
}