Skip to main content

All Questions

Tagged with
1 vote
2 answers
96 views

Can a Proxy detect that a subclass is adding methods to a class?

Given a class like: class A {} Is it possible to modify in any way so that I can proxy when methods are subclassed like so: // proxy the `A` object in some way const handler = { get(target, ...
vixalien's user avatar
  • 370
1 vote
1 answer
66 views

For an instance field which is an array value, how does one handle additional tasks whenever the array mutates by e.g. pushing into or splicing it?

The set accessor does not take place whenever one does mutate the Crumbs class property value by e.g pushing into it. I'm trying to create a class property via set syntax which I expect to handle an ...
Josue Barrios's user avatar
0 votes
1 answer
123 views

How to make a web component return a Proxy (and be extended)

The goal is to have a base class A extending HTMLElement that customizes getters and setters. Then class B would extend class A and do stuff. The way to do this is by wrapping class A with a proxy (...
daniel p's user avatar
  • 939
1 vote
1 answer
490 views

Why is `this` undefined in a constructor defined Proxy method for a derived class?

I attempting to overwrite/proxy a function from a library class. I've done this by extending the class and defining a Proxy object over the method. Alas, like in this question, the this object in the ...
Lee's user avatar
  • 30.6k
0 votes
0 answers
11 views

How can I get parent class scope in a Proxy in a class [duplicate]

class dataset { __data__={}; __actions__ = {}; __data__ = new Proxy(this.__data__,{ set(target,prop,val){ this.__actions__[prop]?this.__actions__[prop]():''; target[prop]=val; ...
Satyam Bharti's user avatar
1 vote
1 answer
52 views

Access proxied properties internally

I'm using model classes that extend a base Model class. The Model class returns a Proxy from the constructor that allows me to access properties passed into the constructor without having to ...
yaakov's user avatar
  • 4,580
1 vote
1 answer
874 views

What's happening when inheriting a Proxy of Class (Function) in JavaScript

I want to inherit a function with proxied constructor, like SubB below; const Base = function () {}; Base.prototype.baseMethod = function () { return 'base method'; } class SubA extends (new Proxy(...
tkondo's user avatar
  • 13