https://github.com/starryinternet/tinyco
Simple coroutines using generators
https://github.com/starryinternet/tinyco
Last synced: 11 months ago
JSON representation
Simple coroutines using generators
- Host: GitHub
- URL: https://github.com/starryinternet/tinyco
- Owner: StarryInternet
- License: mit
- Created: 2017-01-31T14:04:50.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-09T13:36:12.000Z (over 9 years ago)
- Last Synced: 2025-03-30T07:23:26.461Z (about 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.md
Awesome Lists containing this project
README
# tinyco
[](https://travis-ci.org/StarryInternet/tinyco)
Simple coroutines using generators
---
### Installing
```
npm install --save tinyco
```
---
### Example
```js
'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 );
});
```