From 5be154ea2035810462ff0e7051e537870bfc1afb Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 28 May 2018 14:29:31 -0700 Subject: controllers - transactions - merge @frankiebee's work with mine --- app/scripts/lib/util.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/scripts/lib/util.js') diff --git a/app/scripts/lib/util.js b/app/scripts/lib/util.js index 431d1e59c..7ceb9da3c 100644 --- a/app/scripts/lib/util.js +++ b/app/scripts/lib/util.js @@ -99,7 +99,21 @@ function BnMultiplyByFraction (targetBN, numerator, denominator) { return targetBN.mul(numBN).div(denomBN) } +function applyListeners (listeners, emitter) { + Object.keys(listeners).forEach((key) => { + emitter.on(key, listeners[key]) + }) +} + +function removeListeners (listeners, emitter) { + Object.keys(listeners).forEach((key) => { + emitter.removeListener(key, listeners[key]) + }) +} + module.exports = { + removeListeners, + applyListeners, getStack, getEnvironmentType, sufficientBalance, -- cgit