Package Exports
- backthen
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 (backthen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
backthen
Run a callback as a thenable
Usage
var backthen = require('backthen');
var fs = require('fs');
/*
* @param {function} func - function to call
* @param {object} scope - scope for func
* @param {...any} params - parameters for the function
*
* @return {Promise}
*/
backthen(fs.stat, null, 'file.txt')
.then(statFulfilled)
.catch(statRejected)
// Receives array if callback
// invoked with multiple params;
// otherwise a single value
function statFulfilled(stat) {
// handle the fulfillment
}
function statRejected(err) {
// handle the rejection
}