[webkit-dev] JSObjectMakeFunction question

Kalle Vahlman kalle.vahlman at gmail.com
Mon Jun 1 06:53:20 PDT 2009

2009/6/1 Jack Wootton <jackwootton at gmail.com>:
> Hi all,


> I'm attempting to use the function JSObjectMakeFunction described here:
> http://gemma.apple.com/documentation/Carbon/Reference/WebKit_JavaScriptCore_Ref/JSObjectRef/index.html
> I would like to call a JavaScript function from C.  I assume the
> following is required:
> 1. Create a function using JSObjectMakeFunction.
> 2. Add it as a property of the Window JSObjectRef.
> 3. Call it using JSObjectCallAsFunction.

JSObjectMakeFunction creates a JavaScript function *from* C.

To just call a JS function (not create one), all you need to do is get
the function object (most likely JSObjectGetProperty() on the global
object) and then call it with JSObjectCallAsFunction().

Kalle Vahlman, zuh at iki.fi
Powered by http://movial.com
Interesting stuff at http://sandbox.movial.com
See also http://syslog.movial.fi

More information about the webkit-dev mailing list