[英]Apply trap of Proxy
I realized that if I want to have "apply" trap in Proxy, the target of Proxy must be a function.我意识到,如果我想在 Proxy 中设置“应用”陷阱,Proxy 的目标必须是 function。 I need the target to be an object.
我需要目标是 object。 I'm wondering if the target object can have some special "property" to be "callable" but not to be a function.
我想知道目标 object 是否可以具有一些特殊的“属性”以“可调用”但不能成为 function。 Is there such way?
有没有这样的方法? Briefly for some reason I need "target instanceOf Function == false"
简要地说,我需要“目标instanceOf Function == false”
edit: All ways how to make an object callable I found are based on extending Function class.编辑:我发现如何使 object 可调用的所有方法都是基于扩展 Function class。 Actually I don't need the target to be callable.
实际上我不需要目标是可调用的。 All I want is that Proxy of my target can have "apply" trap.
我想要的是我的目标代理可以有“应用”陷阱。 Is there any way without target instance of Function?
没有Function的目标实例有什么办法吗?
It's impossible in JavaScript for now现在在 JavaScript 是不可能的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.