Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Lea Verou, PhD
@leaverou@front-end.social  ·  activity timestamp 3 days ago

In today’s episode of Useless Info I just learned about #JS:

Turns out you cannot subclass Proxy (because it has no prototype).

Nice try Lea 🥲

(Yes, I know that for this particular use case you can have a regular constructor return a Proxy)

class ExtensibleFunction extends Proxy {   constructor (target, traps) {     super(target, {       apply(target, thisArg, args) {         for (se of target.sideEffects) {           Reflect.apply(se, thisArg, args);         }         return Reflect.apply(target, thisArg, args);       }     })   } }
class ExtensibleFunction extends Proxy { constructor (target, traps) { super(target, { apply(target, thisArg, args) { for (se of target.sideEffects) { Reflect.apply(se, thisArg, args); } return Reflect.apply(target, thisArg, args); } }) } }
class ExtensibleFunction extends Proxy { constructor (target, traps) { super(target, { apply(target, thisArg, args) { for (se of target.sideEffects) { Reflect.apply(se, thisArg, args); } return Reflect.apply(target, thisArg, args); } }) } }
  • Copy link
  • Flag this post
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.3.21 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login