aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-08-13 04:29:17 +0800
committerGitHub <noreply@github.com>2016-08-13 04:29:17 +0800
commit4572e689cf3feef22d49ee71f1465a11b305a13c (patch)
tree2476cfe9c584e5f4eea582ce3b81958bc6862d34
parent4f4c78a9fc69902821c2c91c2297ce7ba1d27db9 (diff)
parent0b660f4ac84e27967f96f3292f607aba9afc5ed8 (diff)
downloadtangerine-wallet-browser-4572e689cf3feef22d49ee71f1465a11b305a13c.tar
tangerine-wallet-browser-4572e689cf3feef22d49ee71f1465a11b305a13c.tar.gz
tangerine-wallet-browser-4572e689cf3feef22d49ee71f1465a11b305a13c.tar.bz2
tangerine-wallet-browser-4572e689cf3feef22d49ee71f1465a11b305a13c.tar.lz
tangerine-wallet-browser-4572e689cf3feef22d49ee71f1465a11b305a13c.tar.xz
tangerine-wallet-browser-4572e689cf3feef22d49ee71f1465a11b305a13c.tar.zst
tangerine-wallet-browser-4572e689cf3feef22d49ee71f1465a11b305a13c.zip
Merge pull request #538 from MetaMask/i512
deps - extracted ensnare to module
-rw-r--r--app/scripts/lib/auto-reload.js2
-rw-r--r--app/scripts/lib/ensnare.js24
-rw-r--r--package.json1
3 files changed, 2 insertions, 25 deletions
diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js
index b45f02009..c4c8053f0 100644
--- a/app/scripts/lib/auto-reload.js
+++ b/app/scripts/lib/auto-reload.js
@@ -1,5 +1,5 @@
const once = require('once')
-const ensnare = require('./ensnare.js')
+const ensnare = require('ensnare')
module.exports = setupDappAutoReload
diff --git a/app/scripts/lib/ensnare.js b/app/scripts/lib/ensnare.js
deleted file mode 100644
index 6100f7c79..000000000
--- a/app/scripts/lib/ensnare.js
+++ /dev/null
@@ -1,24 +0,0 @@
-module.exports = ensnare
-
-// creates a proxy object that calls cb everytime the obj's properties/fns are accessed
-function ensnare (obj, cb) {
- var proxy = {}
- Object.keys(obj).forEach(function (key) {
- var val = obj[key]
- switch (typeof val) {
- case 'function':
- proxy[key] = function () {
- cb()
- val.apply(obj, arguments)
- }
- return
- default:
- Object.defineProperty(proxy, key, {
- get: function () { cb(); return obj[key] },
- set: function (val) { cb(); obj[key] = val; return val },
- })
- return
- }
- })
- return proxy
-}
diff --git a/package.json b/package.json
index 5bf4ef475..eefca0500 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,7 @@
"debounce": "^1.0.0",
"dnode": "^1.2.2",
"end-of-stream": "^1.1.0",
+ "ensnare": "^1.0.0",
"eth-bin-to-ops": "^1.0.0",
"eth-lightwallet": "^2.3.3",
"eth-query": "^1.0.3",