block the event loop
8dd8cf62 — Rory Bradford 1 year, 20 days ago
bump version

refs

master
browse log

clone

read-only
https://git.sr.ht/~roryrjb/sleep-sync
read/write
git@git.sr.ht:~roryrjb/sleep-sync

sleep sync

NPM version Build status License Code style

Block execution synchronously

Why?

Obviously this is counter to everything we know about not blocking the event loop I wrote this simple wrapper for testing purposes. Sometimes it's useful to simulate the blocking of the event loop, so we can work on how to handle that scenario from outside of Node.

Installation

$ npm install --save sleep-sync

Usage

const sleep = require('sleep-sync')

doStuffAsync()

sleep(333) // block ALL execution for 333 milliseconds

doMoreStuff()