From 0b660f4ac84e27967f96f3292f607aba9afc5ed8 Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 12 Aug 2016 13:25:38 -0700 Subject: deps - extracted ensnare to module --- app/scripts/lib/ensnare.js | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 app/scripts/lib/ensnare.js (limited to 'app/scripts/lib/ensnare.js') 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 -} -- cgit v1.2.3