weit

WEIT for condition THEN use promise

Usage no npm install needed!

<script type="module">
  import weit from 'https://cdn.skypack.dev/weit';
</script>

README

weit

WEIT for a condition THEN do (javascript)

a simple no dependancy plugin

// usage
weit(_ => condition)
  .then(_ => action)

// example
let i

weit(_ => i)
  .then(_ => console.log('yes'))
  .catch(e => {throw e})

// wait a few seconds
i = true
// outputs "yes"

try me in the web console

Install

the same routine as always

There are NO dependancies

cross compatibility node/browser thanks to moment.js template

  • Usable in browser
<script type="text/javascript" src="path/to/weit/index.js"></script>

There is no CDN for now but it might come if you ask for it.

  • Usable in node
npm install weit
const frum = require('weit')