0.1.9 • Published 5 years ago

lightco v0.1.9

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

lightco

this package is my for learning npm and nodejs, pull request is welcome

useage: node with optional --harmony_destructuring

var fs = require('fs')
var request = require('request')
var lightco = require('lightco')

lightco.run(function* ($) {
    var [error, data] = yield fs.readFile('index.js', 'utf8', $)
    if (error)
        throw error
    console.log(data)

    var [error, response, body] = yield request('http://www.baidu.com', $)
    if (error)
        throw error
    console.log(response.statusCode)

    var [error, data] = yield query(true)
    if (error)
        throw error
    console.log(data)
})

0.1.6 support promise

when onRejected was invoked, the first argument error must be a Error

when onFulfilled was invoked, the first argument must be a null, the second argument must be a data

0.1.7 fix a bug (Generator is already running)

var immediatelyInvoke = function(cb) {
	cb('hi!')
}
// this will be generate a error (Generator is already running)

Unit testing test/test.js

License

MIT

0.1.9

5 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago