Skip to content

Commit

Permalink
Comment out experimental parley.callable()
Browse files Browse the repository at this point in the history
  • Loading branch information
rachaelshaw committed Apr 15, 2019
1 parent 0cba580 commit 95a288a
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions lib/parley.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,44 +351,44 @@ module.exports = function parley(handleExec, explicitCbMaybe, customMethods, tim



/**
* parley.callable()
*
* Build a simple function which returns a Deferred object.
* > This is a shortcut for building simple functions when you don't need the
* > full customizability of calling parley() to build a Deferred for you on the
* > fly (e.g. b/c you don't care about support chain-ability)
*
* CURRENTLY EXPERIMENTAL!
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* @param {AsyncFunction} gracefullyHandleExec
* @param {Number?} timeout
* @param {Error?} omen
*
* @returns {Function}
*/
module.exports.callable = function(gracefullyHandleExec, timeout, omen){

console.warn('WARNING: parley.callable() is currently experimental and should not be relied upon.');

if (!_.isFunction(gracefullyHandleExec) || gracefullyHandleExec.constructor.name !== 'AsyncFunction') {
throw new Error('parley.callable() expects an async function (e.g. `async ()=>{}`) to be provided as the first argument. Instead, got: '+require('util').inspect(gracefullyHandleExec));
}//•

return function handleCalling(/*…*/) {
var parley = module.exports;
var returnedFnArguments = arguments;
var returnedFnCtx = this;//« should really never matter, we just do it this way for consistency
omen = omen || flaverr.omen(handleCalling);
return parley(function(done) {
gracefullyHandleExec.apply(returnedFnCtx, returnedFnArguments)
.then(function(result) {
done(undefined, result);
})
.catch(function(err) {
done(err);
});
}, undefined, undefined, timeout, omen, undefined);
};//ƒ

};//ƒ
// /**
// * parley.callable()
// *
// * Build a simple function which returns a Deferred object.
// * > This is a shortcut for building simple functions when you don't need the
// * > full customizability of calling parley() to build a Deferred for you on the
// * > fly (e.g. b/c you don't care about support chain-ability)
// *
// * CURRENTLY EXPERIMENTAL!
// * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// * @param {AsyncFunction} gracefullyHandleExec
// * @param {Number?} timeout
// * @param {Error?} omen
// *
// * @returns {Function}
// */
// module.exports.callable = function(gracefullyHandleExec, timeout, omen){

// console.warn('WARNING: parley.callable() is currently experimental and should not be relied upon.');

// if (!_.isFunction(gracefullyHandleExec) || gracefullyHandleExec.constructor.name !== 'AsyncFunction') {
// throw new Error('parley.callable() expects an async function (e.g. `async ()=>{}`) to be provided as the first argument. Instead, got: '+require('util').inspect(gracefullyHandleExec));
// }//•

// return function handleCalling(/*…*/) {
// var parley = module.exports;
// var returnedFnArguments = arguments;
// var returnedFnCtx = this;//« should really never matter, we just do it this way for consistency
// omen = omen || flaverr.omen(handleCalling);
// return parley(function(done) {
// gracefullyHandleExec.apply(returnedFnCtx, returnedFnArguments)
// .then(function(result) {
// done(undefined, result);
// })
// .catch(function(err) {
// done(err);
// });
// }, undefined, undefined, timeout, omen, undefined);
// };//ƒ

// };//ƒ

0 comments on commit 95a288a

Please sign in to comment.