Hi,

I'm using JavaScriptCore and have created a custom class to be used within the global context. I've defined a constructor callback with the signature of JSObjectCallAsConstructorCallback:

JSObjectRef PointConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);

and set the returned object as the value of the "Point" property on the global object. When the interpreter encounters the line "var p = new Point();" it calls things correctly and I'm able to create my Point object and it works properly in the scripting environment.

I'm interested in generalizing my code so that I could have a single constructor callback function for multiple objects, and based on the value of the "constructor" argument, create the correct object.

Can any information (e.g., name or JSClassRef) about the class being constructed be extracted from the "constructor" argument? I don't get any enumerable properties from it. I did noticed that the memory address of the "constructor" argument is identical to the one that I got when I called JSObjectMakeConstructor() and set it as a property on the global object.

Also, there doesn't seem to be a way to look up the name (or any other information) on a JSClassRef object. It would be nice to have a function to get back a copy of the JSClassDefinition used to create the class.

Thanks,
Dan
-----------------------------------------------------------------
Dan Waylonis                    [EMAIL PROTECTED]
nekotech SOFTWARE
http://www.nekotech.com
650.964.2490 Voice / Fax



_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to