[webkit-dev] JSValueRef question

Jack Wootton jackwootton at gmail.com
Mon Jun 8 09:42:03 PDT 2009


Hello,

I'm attempting to return an object from C to JS using JSValueRef.  The
documentation for JSValueRef lists the following function

JSObjectRef JSValueToObject(
    JSContextRef ctx,
    JSValueRef value,
    JSValueRef *exception);

I wish to do the opposite, since I imagine I would create and a
JSObject that would be the return value.  Then convert it to a
JSValueRef and return it from my JSObjectCallAsFunctionCallback
implementation.  However I cannot find a function to convert an object
to a value.  Neither can I find a way of creating a JSValueRef from a
JSObjectRef.

Is there a toRef in JSCast that I can use instead?

Also, relating to the previous question, JSValueRef has a lot of
functions for basic types such s boolean, int and string.  However are
there any convenience methods for dealing with arrays?   How does
JSValueRef model arrays?

Many thanks,
Jack


More information about the webkit-dev mailing list