[webkit-dev] how can i extend new javascript object and its event handler?

Adam Roben aroben at apple.com
Wed Jan 2 10:09:44 PST 2008


On Dec 21, 2007, at 4:12 AM, Cloud zheng wrote:

> Hi, all,
>
> I am trying to use webkit engine to build my application. I want to  
> add
> a new javascript object to accomplish some asynchronous operation.
>
> For example, the new javascript object may be named by 'fooObject'. It
> has a function names 'longTimeOperation' and one event handler
> 'onOperationReady'. Because the function may last a long period, so  
> i do
> not want it to be a blocked one. When the function is complete, it can
> notify the fooObject and fooObejct.onOperationReady can be called back
> from webkit engine.
>
> I think it is much like xmlhttprequest method. But i do not how to
> implement it.
>
> can anyone help me? thanks a lot...

You could use setTimeout(onOperationReady, 0) to call onOperationReady  
on a 0-delay timer, which would not block the currently executing code.

-Adam



More information about the webkit-dev mailing list