diff options
Diffstat (limited to 'app/scripts/lib/util.js')
-rw-r--r-- | app/scripts/lib/util.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/scripts/lib/util.js b/app/scripts/lib/util.js index d7423f2ad..ea13b26be 100644 --- a/app/scripts/lib/util.js +++ b/app/scripts/lib/util.js @@ -127,7 +127,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, getPlatform, getStack, getEnvironmentType, |