I'm currently embedding v8 in an application.  As part of this application, 
I need to instantiate 'Classes' that were defined in JS-land.  Whenever I 
use ->NewInstance, the prototype chain does not get set properly, causing 
instanceof to fail (among other things, like the ToString showing 'Object' 
instead of 'Vector3').

*Example C++-ish:*
Local<Function> constructor = [...].Get("Vector3").As<Function>();
Local<Object> newObject = constructor.NewInstance();
[...].Set("someInstance", newObject);

Example JS:
Test.Vector3 = function Vector3() {
  this.x = 1337;
}
doCpp();
console.log(someInstance instanceof Object);
console.log(someInstance instanceof Test.Vector3);
console.log(someInstance.x);
console.log(someInstance);

In this case, I get the following as output:
true
false
1337
[object Object]

When I expect to see:
true
true
1337
[object Vector3]

Cheers, Brett

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to