简体   繁体   中英

Apply trap of Proxy

I realized that if I want to have "apply" trap in Proxy, the target of Proxy must be a function. I need the target to be an object. I'm wondering if the target object can have some special "property" to be "callable" but not to be a function. Is there such way? Briefly for some reason I need "target instanceOf Function == false"

edit: All ways how to make an object callable I found are based on extending 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?

It's impossible in JavaScript for now

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM