Created
April 29, 2018 09:12
-
-
Save azu/d5afa649ae3a5f92dc506861dd10d07e to your computer and use it in GitHub Desktop.
proxy exports geterb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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