aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/nodeify.js
diff options
context:
space:
mode:
authorThomas <tmashuang@gmail.com>2018-04-24 02:22:24 +0800
committerThomas <tmashuang@gmail.com>2018-04-24 02:22:24 +0800
commit010092312998e90688e1bfb004eb55c67a337429 (patch)
tree93a174b2eb7074283d6e43bcc98bc1f2c7925d57 /app/scripts/lib/nodeify.js
parentddece0cc11215b323df96287f39e6758aa559f77 (diff)
parent74c419f9b65841c2966d1fe3b7414bf11e09e0d8 (diff)
downloadtangerine-wallet-browser-010092312998e90688e1bfb004eb55c67a337429.tar.gz
tangerine-wallet-browser-010092312998e90688e1bfb004eb55c67a337429.tar.zst
tangerine-wallet-browser-010092312998e90688e1bfb004eb55c67a337429.zip
Merge branch 'master' into testing
Diffstat (limited to 'app/scripts/lib/nodeify.js')
-rw-r--r--app/scripts/lib/nodeify.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/scripts/lib/nodeify.js b/app/scripts/lib/nodeify.js
index 9b595d93c..25be6537b 100644
--- a/app/scripts/lib/nodeify.js
+++ b/app/scripts/lib/nodeify.js
@@ -1,6 +1,14 @@
const promiseToCallback = require('promise-to-callback')
const noop = function () {}
+/**
+ * A generator that returns a function which, when passed a promise, can treat that promise as a node style callback.
+ * The prime advantage being that callbacks are better for error handling.
+ *
+ * @param {Function} fn The function to handle as a callback
+ * @param {Object} context The context in which the fn is to be called, most often a this reference
+ *
+ */
module.exports = function nodeify (fn, context) {
return function () {
const args = [].slice.call(arguments)