Intercept ES6 class extensions

43 views
Skip to first unread message

Darin Dimitrov

unread,
Feb 20, 2020, 8:43:36 AM2/20/20
to v8-users
I am embedding V8 and execute the following javascript:

class Parent {
}

class Child extends Parent {
}


Is there some API which would allow me to register an interceptor within the isolate which will get executed when registering such class? In this case the interceptor would receive the base class that we are extending.

Another use-case is with mixins:

let myMixin = superclass => class extends superclass {
    calc
() {
   
}
}

class Parent {
}

class Child extends myMixin(Parent) {
    calc
() {
       
...
   
}
}


Here I would like the interceptor to receive the base class that is being extended and the mixin (there could be more than one).

Is this possible with the public API in v8.h?
Reply all
Reply to author
Forward
0 new messages