summaryrefslogtreecommitdiff
path: root/lib/internal/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/util.js')
-rw-r--r--lib/internal/util.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/internal/util.js b/lib/internal/util.js
index 1ff25dbc7d..0a31973918 100644
--- a/lib/internal/util.js
+++ b/lib/internal/util.js
@@ -26,7 +26,8 @@ const {
getHiddenValue,
setHiddenValue,
arrow_message_private_symbol: kArrowMessagePrivateSymbolIndex,
- decorated_private_symbol: kDecoratedPrivateSymbolIndex
+ decorated_private_symbol: kDecoratedPrivateSymbolIndex,
+ sleep: _sleep
} = internalBinding('util');
const { isNativeError } = internalBinding('types');
@@ -385,6 +386,17 @@ function once(callback) {
};
}
+let validateUint32;
+
+function sleep(msec) {
+ // Lazy-load to avoid a circular dependency.
+ if (validateUint32 === undefined)
+ ({ validateUint32 } = require('internal/validators'));
+
+ validateUint32(msec, 'msec');
+ _sleep(msec);
+}
+
module.exports = {
assertCrypto,
cachedResult,
@@ -402,6 +414,7 @@ module.exports = {
normalizeEncoding,
once,
promisify,
+ sleep,
spliceOne,
removeColors,