Basically, at startup I make a function template for each JS class. I make
an instance template, a prototype template, and a constructor from that
template.
I add accessors as follows:
InstanceTemplate->SetAccessor(v8::String::NewFromUtf8(v8::Isolate::
GetCurrent(), name), Getter, Setter);
Prototype->SetAccessor(v8::String::NewFromUtf8(v8::Isolate::GetCurrent(),
name), Getter, Setter);
And I create instances of the class and return them to script as follows:
v8::Handle<v8::Object> returnobj = JSo.InstanceTemplate->NewInstance
();
returnobj->SetAlignedPointerInInternalField(0, obj);
returnobj->SetInternalField(1, v8::Integer::NewFromUnsigned(iso, JSo
.ID));
/////
// Set the weak reference callback
v8::Persistent<v8::Object> preturnobj(iso, returnobj);
preturnobj.SetWeak(obj, JSo.Finalize);
args.GetReturnValue().Set(preturnobj);
The main issue is that, while I can use the objects just fine for
parameters to native functions (so I know that at the very least they are
wrapped correctly), but the accessors can't be called--indeed, they don't
show up in object.keys, and they are undefined.
What am I doing wrong here? This used to work.
--
--
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.