Skip to content

Instantly share code, notes, and snippets.

@azu
Created April 29, 2018 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/d5afa649ae3a5f92dc506861dd10d07e to your computer and use it in GitHub Desktop.
Save azu/d5afa649ae3a5f92dc506861dd10d07e to your computer and use it in GitHub Desktop.
proxy exports geterb
window.C = {};
var map = {};
var _exports = new Proxy(exports, {
set: function(target, name, value) {
window.C[name] = 0;
map[name] = value;
Reflect.defineProperty(target, name, {
get() {
var count = window.C[name] || 0;
window.C[name] = count + 1;
return map[name];
}
})
return true;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment