set-timeout-sync

A blocking, synchronous imitation of setTimeout

Usage no npm install needed!

<script type="module">
  import setTimeoutSync from 'https://cdn.skypack.dev/set-timeout-sync';
</script>

README

set-timeout-sync License: MIT snekjs on NPM

A blocking, synchronous imitation of setTimeout.

Installation

npm install set-timeout-sync

Usage

const setTimeoutSync = require('set-timeout-sync')

console.log("I'm first")

setTimeoutSync(function() {
  console.log("I'm blocking!")
}, 2000)

console.log("I'm last")

// I'm first
// <wait 2000ms>
// I'm blocking!
// I'm last

License

This project is open source and available under the MIT License.