https://github.com/caiogondim/msleep
⛔ Small function that mimics the usleep C function, blocking the main thread
https://github.com/caiogondim/msleep
Last synced: 3 months ago
JSON representation
⛔ Small function that mimics the usleep C function, blocking the main thread
- Host: GitHub
- URL: https://github.com/caiogondim/msleep
- Owner: caiogondim
- License: mit
- Created: 2015-06-02T13:43:32.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-04-03T03:53:21.000Z (about 7 years ago)
- Last Synced: 2025-02-25T02:23:16.921Z (4 months ago)
- Language: JavaScript
- Homepage: https://npm.im/msleep
- Size: 84 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# msleep
Small function that mimics the `usleep` C function, blocking the main thread.
But instead of microseconds works with miliseconds, to feel more JS-like.Useful for:
- Debugging race conditions
- Simulate blocked UI thread on the browser## Installation
```shell
npm install --save msleep
```## Usage
```js
msleep(5000) // Will block the main thread for half a second
```---
[caiogondim.com](https://caiogondim.com) ·
GitHub [@caiogondim](https://github.com/caiogondim) ·
Twitter [@caio_gondim](https://twitter.com/caio_gondim)