Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-17 Thread Xiong
Hi, Su Yes, this is the key point of the problem. In my program, many Object use the same staticFunc entry[Program Architecture]. So, in the getValue_cb callback function, we need do extra two things: 1.Get the Object name, here is "myObject"; [WE CAN NOW] 2.Get the propertyName of the method,

Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-15 Thread Zhe Su
AFAIK, there is no way to achieve what you want by using staticFunc structure. Of course, if you use different C functions for each staticFunc entry, you actually don't need the name. Regards James Su On Fri, May 15, 2009 at 3:24 PM, Xiong wrote: > Thanks Su. > > I think i know you mean. > > To

Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-15 Thread Xiong
Thanks Su. I think i know you mean. To get the method name ["getValue"] via attach a private data to function object which create by JSObjectMake(). Yes, it's a better way, but not for me. In my program, we have many Object and it's method and now all in staticFunc structure. Thanks again. -X

Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-14 Thread Zhe Su
If you create a JSObject with JSObjectMake() function, you can have a private data associated to the newly created JSObject. You can store anything you want in the private data. So following approach might be feasible for you: 1. define a special JSClass for your function, which has finalize and c

Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-14 Thread Xiong
Darin, thanks for you help. I think we must implement the extra member for "function object" in my program architecture. Maybe more work. Thanks again. -Xiong On Fri, May 15, 2009 at 11:32 AM, Darin Adler wrote: > On May 14, 2009, at 7:53 PM, Xiong wrote: > > So,can we add a member for the

Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-14 Thread Darin Adler
On May 14, 2009, at 7:53 PM, Xiong wrote: So,can we add a member for the "function object" to store the method name[here is "getValues"] in theoretical ? Yes, in theory you could do that. Although that’s not the typical pattern. And this also like the "JSObjectRef object" variable in the

Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-14 Thread Xiong
Thanks Darin. For the first problem, as you said, all the functions are objects, and also have **properties**. So,can we add a member for the "function object" to store the method name[here is "getValues"] in theoretical ? And this also like the "JSObjectRef object" variable in the callback prot

Re: [webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-14 Thread Darin Adler
On May 14, 2009, at 7:03 PM, Xiong wrote: 1what is the purpose of the "JSObjectRef function" variable? In my case, we never use. It’s fine to not use this if you don’t need to. In JavaScript, functions are objects. Like other objects they can have properties. This argument is passed t

[webkit-dev] JSObjectCallAsFunctionCallback question

2009-05-14 Thread Xiong
Hello all, I have implement a JS object named "myObject" with the JavaScriptCore(JSC) API, and it has a method named getValues(), called as following: myObject.getValues(); And it define like this: JSStaticFunction staticFunc[] = { {"getValues", getValue_cb, kJSPropertyAttributeReadOnly}