Created
December 25, 2018 20:22
-
-
Save MazeW/8bcf7f514012fec80cbebac3d6607563 to your computer and use it in GitHub Desktop.
Simple sleep function for node.js 9.3 or newer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep(n) { | |
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, (n * 1000)); | |
} | |
// where n = seconds | |
// remove the * 1000 multiplier in the function to make it miliseconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment