actualy, I am doing this when declaring the type:
v8::Persistent<v8::ObjectTemplate> v8_combo_persistent;
int v8_combo_id = 0;

void v8_create_combo_template(v8::Isolate* isolate,
                      v8::Handle<v8::ObjectTemplate> global)
{
  if(v8_combo_id > 0) return;
  v8_combo_id = 1;

  v8::Handle<v8::ObjectTemplate> v8_combo_templ;
  v8_combo_templ = v8::ObjectTemplate::New();
  v8_combo_templ->SetInternalFieldCount(2);


and this when creating the v8 object:
  v8::Handle<v8::ObjectTemplate> v8_combo_templ = 
*reinterpret_cast<v8::Handle<v8::ObjectTemplate>*>(&v8_combo_persistent);
  v8::Local<v8::Object> v8_value = v8_combo_templ->NewInstance();
  v8_value->SetInternalField(0, v8::External::New(args.GetIsolate(), (void 
*) value));
  v8_value->SetInternalField(1, v8::External::New(args.GetIsolate(), (void 
*) &v8_combo_id));
  args.GetReturnValue().Set(v8_value);

like this, the id is ensuring the template is initialized only once and the 
int pointer is guaranteed to be unique, and so a good identifier of the 
class...


It si the other way around that is bogging me... map it will be, thanks.

-- 
-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to