diff options
deps - extracted ensnare to module
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/auto-reload.js | 2 | ||||
-rw-r--r-- | app/scripts/lib/ensnare.js | 24 |
2 files changed, 1 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 -} |