[webkit-dev] RegExp on JSStaticFunction

Geoffrey Garen ggaren at apple.com
Tue Apr 3 09:46:03 PDT 2012


JavaScript doesn't have a concept of "intercept any method invocation". However, it does have a concept of "intercept any property access". I believe you could accomplish what you want by implementing a catch-all JSObjectGetPropertyCallback that created the necessary function objects on the fly, and cached them.

Geoff

On Apr 3, 2012, at 1:02 AM, Iker Perez de Albeniz wrote:

> Hi,
> 
> I have estarted a personal project and i am new on wbkit development. I have a question about the posibility of using regular expression on JSStaticFunction struct name.. so i can resolve every methos of a class with an unique funcrtion..
> 
> My idea is to hace a fucntion that conects to a socket where the "core" of the class is available.. so i can do something like..
> 
> 
> static JSValueRef myclass_mymethod(JSContextRef context,
>                        JSObjectRef function,
>                        JSObjectRef thisObject,
>                        size_t argumentCount,
>                        const JSValueRef arguments[],
>                        JSValueRef *exception)
> {
>    // get the name of the funcion called
>    //open a socket and call to a REST service
> }
> 
> 
> static const JSStaticFunction class_staticfuncs[] ={
>   { ".*", myclass_mymethod, kJSPropertyAttributeReadOnly },
>   { NULL, NULL, 0 }
> };
> 
> The idea is to create a bridge betwing JS and a core accesible via sockets/Json..
> 
> 
> Regards. 
> _______________________________________________
> 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