Package Exports
- asyncc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (asyncc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
asyncc
Just async patterns
Asynchronous patterns, no dependencies, no bloat, more isn't needed.
The modules provided are not compatible with async syntax.
Serial execution patterns
Parallel execution patterns
Usage
As ES6 Modules
import {NoPromise, connect} from 'asyncc/src'
// async function
let asy = (res, cb) => {
setImmediate(() => { cb(null, res + 3) })
}
// async function causes error
let asyError = (res, cb) => {
setImmediate(() => { cb('error', res + 10) })
}
// error trap
let trap = (err, res, cb) => {
cb(null, res)
}
// deferred execution of async chain with error traps
let p = new NoPromise(101)
p
.then(asy)
.then(asyError)
// connect like async chain with error traps
connect(
asy,
asyError,
asy,
trap,
asy
)(1, (err, res) => {
console.log(err, res)
//> null 17
p // continue execution of NoPromise chain
.then(asy)
.catch(trap)
.then(asy)
.end((err, res) => {
console.log(err, res)
//> null 117
})
})As CommonJS Modules
const {NoPromise, connect} = require('asyncc')
...