gocsp-timeout

0.0.1 • Public • Published

gocsp-timeout

Timeout timer

Usage

var go = require('gocsp-go')
var select = require('gocsp-select')
var timeout = require('gocsp-timeout')
 
go(function* () {
 
    yield timeout(1000) // sleep for a while
 
    yield select(function (s) {
        s(go(function* () {
            // ...
            yield timeout(50)
            // ...
        }), function () {
            console.log('should reach here')
        })
        ||
        s(timeout(100), function () {
            console.log('should not reach here')
        })
    })
})

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i gocsp-timeout

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • gyson