try-thread-sleep

Use thread-sleep if native compilation succeeded, otherwise it's a noop

MIT License

Downloads
1.7K
Stars
4
Committers
3

try-thread-sleep

Use thread-sleep if native compilation succeeded, otherwise it's a noop

Installation

npm install try-thread-sleep

Usage

var sleep = require('try-thread-sleep');

if (!sleep.native) {
  console.warn('native thread-sleep was not available');
}

// this next line will take roughly 1 second if native compilation succeeded,
// otherwise it will be almost instant.
sleep(1000);

License

MIT