cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabbage <purplecabb...@gmail.com>
Subject Re: Using cordova in web workers
Date Thu, 13 Feb 2014 06:58:37 GMT
Yes, as will the call to cordova.exec so there is little benefit in using a worker here, unless
you wanted to do a bunch of work, and then call exec. 

Sent from my iPhone

> On Feb 12, 2014, at 8:30 PM, "Christian G. Warden" <cwarden@xerus.org> wrote:
> 
> And stringByEvaluatingJavaScriptFromString will always run in the
> context of the main window rather than the web worker, I presume?
> 
>> On Wed, Feb 12, 2014 at 10:45:31PM -0500, Andrew Grieve wrote:
>> No is working on this that I know of. XHRs from a worker would likely kick
>> the native bridge fine, so long as the user-agent of the worker is set
>> correctly.
>> 
>> Problem is that the native side does a stringByEvaluatingStringFromString
>> to retrieve the payload of the exec() command, as well as to send responses.
>> 
>> Probably the best way to implement this would be to have exec() from the
>> worker use postMessage() to route them via the main window.
>> 
>> 
>> On Wed, Feb 12, 2014 at 7:51 PM, Christian G. Warden <cwarden@xerus.org>wrote:
>> 
>>> Will XHRs to gap_exec within a web worker already be intercepted by
>>> cordova, or do both the native and javascript sides need to be updated
>>> to support calling cordova APIs from within a web worker?
>>> 
>>> In either case, has any progress been made on this in a public repo?
>>> 
>>> Thanks,
>>> Christian
>>> 
>>>> On Wed, Dec 11, 2013 at 02:08:54PM +1000, Brian LeRoux wrote:
>>>> I'm getting into a refactor of cordova.js and will keep this in mind
>>> while
>>>> I'm in there. Like Andrew says things are somewhat coupled at the moment
>>>> but that doesn't mean it has to be.
>>>> 
>>>> 
>>>> On Wed, Dec 11, 2013 at 12:17 PM, Andrew Grieve <agrieve@chromium.org
>>>> wrote:
>>>> 
>>>>> It could be made to work, but would certainly require some effort.
>>>>> 
>>>>> 
>>>>> On Tue, Dec 10, 2013 at 2:32 PM, Michael Gauthier <
>>> mike@silverorange.com
>>>>>> wrote:
>>>>> 
>>>>>> Is it possible to use cordova inside a web worker? I tried importing
>>> the
>>>>>> cordova script but it makes reference to 'window' which is forbidden
>>> in
>>>>>> web-worker context.
>>>>>> 
>>>>>> It would be useful to be able to call cordova functions from within
>>> a web
>>>>>> worker.
>>>>>> 
>>>>>> Cheers,
>>>>>> Mike
>>> 

Mime
View raw message