Netscape, and all decendants use "ns" to prefix as opposed to "NS" for NeXTSTEP. A bit confusing for some.

Darren VanBuren
-------------------------
Sent from my iPod

Try Fedora 10 today. Fire it up. http://fedoraproject.org/

On Jul 6, 2009, at 2:37, Jack Wootton <[email protected]> wrote:

For completion, I can answer my own question.  NSObject stands for
NeXTStep Object.  Which is related to Objective C and not webkit.  I
assumed it was something like "NetScape Object".  My mistake.  If like
me you're more familiar with C++ than Objective C - this seems like a
reasonable guide:

http://www.otierney.net/objective-c.html

2009/7/6 Jack Wootton <[email protected]>:
On Sat, Jul 4, 2009 at 4:52 PM, 胡 波<[email protected]> wrote:
Thank you very much!

I understand your steps,But I do not understand the implement process! In the samples you provide with me , I do not find the .cpp file. I want to get
a sample for windows.Can you help me?

my aim:"widget" object is the same the "history" object,for
example,to:"widget" object: window.widget.(property/ method),:to :"history"
object,window.history.back();

thank you!


In the JSPong example I linked, the first thing to look at should
probably be PongAI.js.  Since this gives you an idea of what is being
achieved. Then read the ReadMe.txt to get an overview of the different classes involved. You could then have a look at JSShape.m is where the
"ball" class is constructed and it's properties are associated with
Objective C implementation (by adding static values to the class
definition).

There is one oddity though, I do not understand why NSObject is
inherited from, since I thought use of the JavaScriptCore API meant
that developers didn't have to inherit from classes in this
manner...that the API did this for them.  Maybe someone on this
mailing list can help clarify this?




--- 09年7月4日,周六, Jack Wootton <[email protected]> 写道:

发件人: Jack Wootton [email protected]
主题: Re: [webkit-dev] how to extend the javascript native object?
收件人: "胡 波" <[email protected]>
抄送: [email protected]
日期: 2009年7月4日,周六,上午12:26

To add, it maybe useful to look at the following files in the
JavaScriptCore (Although, personally I didn't find them particularly
easy to understand.)

JavaScriptCore\API\testapi.c
testapi.js


There are also some example programs that do what you want to do, only
with different objects.

JSPong: http://developer.apple.com/SampleCode/JSPong/index.html

JSInterpreter:
http://developer.apple.com/samplecode/JSInterpreter/index.html

More programs can be found here:

http://developer.apple.com/SampleCode/Cocoa/idxInternetWeb-date.html



2009/7/3 Jack Wootton <[email protected]>:
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:


http://gemma.apple.com/documentation/Carbon/Reference/WebKit_JavaScriptCore_Ref/index.html#//apple_ref/doc/framework/javascriptcore_fw

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, 胡 波<[email protected]> w rote:
   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
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev





--
Regards
Jack




--
Regards
Jack

________________________________
好玩贺卡等你发,邮箱贺卡全新上线!



--
Regards
Jack




--
Regards
Jack
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to