Skip to main content

All Questions

-1 votes
1 answer
207 views

Javascript construct trap not working in class returning proxy

I am trying to create a little javascript two way form binder using proxies. I am stuck on how I can intercept 'new' calls. I use a 'construct' trap but it doesn't fire. Here is my code, I have ...
kiwichris's user avatar
  • 355
6 votes
1 answer
578 views

Using ES6 Proxy to lazily load resources

I am building something like an ActiveRecord class for documents stored in MongoDB (akin to Mongoose). I have two goals: Intercept all property setters on a document using a Proxy, and automatically ...
Rafael Sofi-zada's user avatar
2 votes
0 answers
242 views

run cleanups automatically when a block variable gets out of scope in javascript

the answer to this question will probably be "it cannot be done with out writing a custom javaScript parser" but here i go: while developing some lightweight scripting tool i ran into a need to do ...
tal shachar's user avatar
3 votes
1 answer
572 views

Trapping class definition via Proxy in ES6

Is it possible to trap extends? Or to trap definitions inside a class? Eg: class B extends A { method1( ) { } static method2( ) { } } Is there any way to trap the events that: B extended A. ...
Gubbi's user avatar
  • 766
5 votes
1 answer
595 views

What would be a use case for identity-preserving membrane proxies?

When I was reading about ES6 Proxies, it seemed simple enough to understand until I had taken a look at this example. I'm stumped. I don't understand the "wet/dry" terminology that they use, ...
kpimov's user avatar
  • 13.9k
31 votes
4 answers
10k views

How do I trap arguments to a target method when using a Proxy object?

I'm trying to use Javascript Proxy objects to trap the arguments that are passed to a 'method' of the target that I'm proxying. Please consider this example: var test = { doSomething: function() ...
Decent Dabbler's user avatar