当前位置:网站首页>How to test whether an object is a proxy- How to test if an object is a Proxy?

How to test whether an object is a proxy- How to test if an object is a Proxy?

2022-07-06 14:21:00 Technology feast

problem :

I would like to test if a JavaScript object is a Proxy . I want to test one JavaScript Whether the object is a Proxy .The trivial approach Trivial methods

if (obj instanceof Proxy) ...

doesn't work here, nor does traversing the prototype chain for Proxy.prototype , since all relevant operations are effectively backed by the underlying target. It doesn't work here , Can't traverse Proxy.prototype Prototype chain of , Because all related operations are effectively supported by the underlying goals .

Is it possible to test if an arbitrary object is a Proxy? Whether it is possible to test whether any object is a proxy ?


Solution :

Reference resources : https://stackoom.com/en/question/2ScB1
原网站

版权声明
本文为[Technology feast]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131404398141.html