Hi all,
What is the correct way of creating an instance of a javascript class
from within C++, so that methods that are added to the
class .prototype in javascript are available on the new instance?
eg:
javascript:
Vector.prototype.inspect = function(){
return "x=" + this.x;
}
c++
template_ = ObjectTemplate::New();
template_->SetInternalFieldCount(1);
template_->SetAccessor(String::New("x"), getX, setX);
MyVector vector;
Local<Object> instance = template_->NewInstance();
instance->SetInternalField(0, External::New(vector));
I can't work out how it should inherit from the Vector prototype
chain... Am I missing something?
Ben
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---