I am embedding V8 and I have the following javascript:

var TSObject = (function (_super) {
    __extends(TSObject, _super);
    function TSObject() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    return TSObject;
}(String));

As an embedder, I have registered the custom "__extends" function on the 
global object and my C++ callback is successfully invoked. 

My purpose is to be able to intercept the instantiation of such objects:

var obj = new TSObject();

and to alter the type of js objects returned from the TSObject constructor 
(ideally by invoking some user provided C++ callback). Can such a hook be 
achieved from inside the "__extends" callback?

The closest I could get is provide custom constructors for the base class 
but when the "_super.apply(this, arguments)" call is made, I am losing the 
information about TSObject and I only have access to the base class.

Is there some way that I could walk the call frames and replace this 
constructor or reach the TSObject function so that I have information about 
this type? 

I can get the current callstack by using "v8::StackTrace::CurrentStackTrace" 
but this only gives me the function name as Local<String> and I cannot 
reach the actual Local<Function> from this frame.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/959f2a23-5dd1-49fa-81c8-62b0b483ea4d%40googlegroups.com.

Reply via email to