[webkit-dev] Embedding JavaScriptCore - Creating new object types ???

Martin Wengenmayer martin at cheetah3d.de
Wed Jan 7 16:25:28 PST 2009

Hi Maciej and Darin,
that works like a dream. Thank you very much for the fast help. That  
was the only thing I couldn't figure out by myself.  Now I can replace  
SpideMonkey with JavaScriptCore in my app. :-)


Am 07.01.2009 um 22:28 schrieb Darin Adler:

> On Jan 7, 2009, at 11:50 AM, Martin Wengenmayer wrote:
>> var a = new Vector3f(0,1,0);
> In JavaScript. the way this works is that Vector3f has to be some  
> object that's in scope. This is normally accomplished by adding it  
> as a property to the global object. That object is called the  
> "constructor". If the object is one that created with the  
> JavaScriptCore API, then the function callAsConstructor will be  
> called on it to implement the new expression. See JSClassDefinition  
> in JSObjectRef.h for details. The callAsConstructor object can then  
> return an object of any type, including some other type of custom  
> object backed by native code.
>    -- Darin

More information about the webkit-dev mailing list