An open API service indexing awesome lists of open source software.

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

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)