Simple example of using ES6 generators to implement cooperative multitasking
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
coroutines.js
coroutines_with_await.js

README.md

es6-simple-coroutines

Simple example of using ES6 generators to implement cooperative multitasking.

const loop = new scheduler();

loop.add_task(a_generator_instance);
loop.add_task(another_generator_instance);
loop.add_task(and_so_on);

loop.run();

That's it!


Lifted almost directly from Python examples presented by Robert Smallshire of Sixty North at ACCU 2017. Many thanks!