[webkit-dev] Identifying Views / Windows inside
Jack Wootton
jackwootton at gmail.com
Mon Jun 8 05:20:30 PDT 2009
On Fri, Jun 5, 2009 at 5:27 PM, Darin Adler<darin at apple.com> wrote:
> On Jun 5, 2009, at 1:41 AM, Jack Wootton wrote:
>
>> 1. Does it have to be static?
>
> No.
>
> This is not a JavaScriptCore or WebKit question but a C language question.
> The keyword "static" makes the function have internal linkage. You can read
> up on the topic in any advanced C programming reference.
My mistake was thinking the (JSObjectCallAsFunctionCallback) had to be
static, since in the Pong example, the function is static. I also
envisaged having the function as a member function, but it seems it
must be a free-standing function.
>
>> In order to get a property of the Window object I need the JSObjectRef of
>> the Window. But I do not have it inside the function.
>
> Since the window object is the global object for this context you can get it
> with the JSContextGetGlobalObject function.
This worked, thanks for pointing out this function. I have only really
looked at the JSObjectRef library / functions.
>
> If you have more advanced requirements you can attach any amount of your own
> private data to the function object you created using the JSObjectSetPrivate
> function.
This seems extremely useful. Can "private data" include e a C pointer
to an object?
>
> -- Darin
>
>
--
Regards
Jack
More information about the webkit-dev
mailing list