Hi there !

I've got a nice C++ Object Wrapped Window. The C++ pointer is stored in the 
#0 internal field.
I can create some Window in JS like this :

wnd = new Window (parent);
wnd.text = "Hi there!"; // trigger an C++ accessor

This works just fine.

Then I want to create a derived class from my Window, but in JS, not in C++.

If i do :

function MyWindow(parent) {
    Window.call(this, parent);
}
MyWindow.prototype.__proto__ = Window.prototype;
MyWindow.__proto__ = Window;

mwnd = new MyWindow(parent);

I got an error while Window.call, be cause the new object has no internal 
field.

So I've tried this :

function MyWindow(parent) {
    this.__proto__.__proto__ = new Window(parent);
}
MyWindow.__proto__ = Window;

mwnd = new MyWindow(parent);

And it's nearly working.

The problem is when I try to set a value into the wrapped Window with an 
accessor:

mwnd.text = "Hi there!";

The accessor of Window is not triggered, instead, "Hi there!" is just 
stored in the text property of mwnd.


So my question is : How to properly inherit a C++ Wrapped object in JS ?


Best regards,
Florent

-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users

Reply via email to