[webkit-dev] JSClassCreate & JSObjectSetProperty question

Darin Adler darin at apple.com
Thu May 28 07:49:51 PDT 2009


On May 28, 2009, at 1:59 AM, Jack Wootton wrote:

> I understand the first part of your answer, but what i can't find it
> how to specify which C functions should be"bound" to the JavaScript
> functions.  So for example, I add a new attribute to the window object
> named  "foo", and I add a method to foo, named "func1".  This would
> result in window.foo.func1(), or just foo.func1() (since the window
> object does not need to be explicitly used).  However I would like
> foo() to call some C function, the functionality of func1() needs to
> be implemented in C and a value returned to the JavaScript
> environment.  How I can i do this with JSObjectRef or the rest of the
> JavaScriptCore API?

Rather than try to answer your question, let me point you toward a Mac  
OS X example program that does this.

     <http://developer.apple.com/samplecode/JSPong/>

If after looking at this sample you still have questions, feel free to  
ask again.

     -- Darin



More information about the webkit-dev mailing list