tinyco

Simple coroutines using generators

Usage no npm install needed!

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

README

tinyco

Build Status

Simple coroutines using generators


Installing

npm install --save tinyco

Example

'use strict';

const c = require('tinyco');

function asyncAdd( a, b ) {
  return new Promise( resolve => setTimeout( () => resolve( a + b ), 100 ) );
}

c(function*() {
  let val = yield asyncAdd( 1, 2 );
  console.log( val );
});