Hi > I am defining JavaScript bindings to methods of a new class in WebCore using > an IDL. I have added a new class to WebCore, where I want some of > the methods in this new class to return immediately, and upon completion I > want these methods to return the status to JavaScript using callbacks. What > would be the best way of doing this in WebCore. > Can anyone please assist me with this?
There is a couple of areas that uses asynchronous dispatching inside WebCore. You could mimic what is done in those cases. One way is to use an EventListener and dispatch a custom Event on your object with your return value inside. That's what a lot of objects are using: one simple example would be Source/WebCore/xml/XMLHttpRequest.idl as there is only few events (onReadyStateChange or onprogress are the most relevant IMHO) and not a lot of other code around. The dom/ directory has also a lot of examples of event dispatching. The other way is what Geolocation is doing: you register a callback and manually call it with the right arguments. See Source/WebCore/page/Geolocation.idl and the bindings side. This will likely require some custom binding code to check the object passed as an argument and call the right method. Hope it helps, Julien _______________________________________________ webkit-help mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-help
