[webkit-dev] how to extend the javascript native object?

Jack Wootton jackwootton at gmail.com
Fri Jul 3 09:22:01 PDT 2009

Are you saying you wan to add a 'widget' property to the Window
object?  If so, then the JavaScriptCore API has methods that will
help you:

Here is the API:


If this is what you wish to do, then the following is a rough guide of
what you need to do:

1. Create an empty class definition, you can create an empty class
definition using kJSClassDefinitionEmpty.
2. Use the class definition with the JSCoreAPI method "JSClassCreate"
to create your class.
3. Use your new class with JSObjectMake to create your new JSObject
(this will be your widget object).
4  Use JSObjectSetProperty to add your new JSObject as a property of
the Window object.

On Fri, Jul 3, 2009 at 4:51 PM, 胡 波<h3282129 at yahoo.com.cn> wrote:
>     I want to extend the javascript native object,such as widget object,and
> make it inherit window object. That is to say,when the widget object is
> extended, and we can use it by the window.widget.(method/property) in the
> html document?
> ________________________________
> 好玩贺卡等你发,邮箱贺卡全新上线!
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


More information about the webkit-dev mailing list