@shimo/deferred

A javascript library implement deferred promise proposed by Mozilla.

Usage no npm install needed!

<script type="module">
  import shimoDeferred from 'https://cdn.skypack.dev/@shimo/deferred';
</script>

README

deferred

A javascript library implement deferred promise proposed by Mozilla.

usage

npm i -S @shimo/deferred
import Deferred from '@shimo/deferred'

const deferred = new Deferred<void>();

async function foo() {
  await deferred.promise;
  console.log('foo');
}

function main() {
  foo();
  deferred.resolve();
}

main();