4 ms·
This is what Proxy[1] is for. [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy https://developer.mozilla.org/en-US/do
by tkone 9y ago
This is what Proxy[1] is for.
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- emehrkay 9y agoI've used Proxy in the past. It doesn't allow for the capture of both `object.attr_does_not_exist` and `object.methodDoesNotExist()` simultaneously, it is one or the other. I will admit that I am trying to use another lang's paradigms in JS, but only because it is so similar and it makes sense to me. But I may be able to use Proxy just to capture object changes. I will try it out
- houli 9y agoCould you have your "get" handler do its thing and have it forward on the arguments it received to the "apply" handler if necessary with an extra flag argument and vice versa?
- ngz00 9y agoCheck this out: https://gist.github.com/torgeir/e528337e7a9a41c96ac9 https://gist.github.com/torgeir/e528337e7a9a41c96ac9