0.1.9 • Published 7 years ago

lightco v0.1.9

Weekly downloads
1
License
MIT
Repository
github
Last release
7 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

7 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago