You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Joe Bowser <bo...@gmail.com> on 2012/09/20 23:38:17 UTC
[Android] Is it cool if I did this in cordova-js in lib/android/exec.js?
- if (nativeToJsBridgeMode === undefined) {
- if (callback.isAvailable()) {
- androidExec.setNativeToJsBridgeMode(nativeToJsModes.HANGING_GET);
- } else {
- androidExec.setNativeToJsBridgeMode(nativeToJsModes.POLLING);
- }
- }
+ androidExec.setNativeToJsBridgeMode(nativeToJsModes.ONLINE_EVENT);
+
Seriously, I want to get a bunch of these "My app freezes when I go
offline" errors gone, and it's easier if we don't have to tell users
to switch the bridge.
Joe
Re: [Android] Is it cool if I did this in cordova-js in lib/android/exec.js?
Posted by Andrew Grieve <ag...@chromium.org>.
heh, whoops, not one of my best emails :P
Change it in the JS here:
71 if (jsToNativeBridgeMode === undefined) {
72 androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
73 }
PROMPT->ONLINE_EVENTS
On Thu, Sep 20, 2012 at 7:08 PM, Joe Bowser <bo...@gmail.com> wrote:
> Um, it's both line 39. Is there somewhere else where I should change this?
>
> On Thu, Sep 20, 2012 at 4:01 PM, Andrew Grieve <ag...@chromium.org>
> wrote:
> > I think it'd be better to change the default value here:
> >
> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/src/org/apache/cordova/NativeToJsMessageQueue.java;h=d2732c46213ac7ae786b5f1a850d42a078b2f6e4;hb=HEAD#l39
> >
> > and here:
> >
> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/src/org/apache/cordova/NativeToJsMessageQueue.java;h=d2732c46213ac7ae786b5f1a850d42a078b2f6e4;hb=HEAD#l39
> >
> > And get rid of the line you just added:
> > 69 function androidExec(success, fail, service, action, args) {
> > 70 // Set default bridge modes if they have not already been set.
> > 71 if (jsToNativeBridgeMode === undefined) {
> > 72 androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
> > 73 }
> > 74
> androidExec.setNativeToJsBridgeMode(nativeToJsModes.ONLINE_EVENT);
> > <<<< THIS ONE
> > 75
> >
> >
> > Since that prevents anyone from setting it to anything else. :P
> >
> > Having the defaults set to it mean that there doesn't need to be an
> > explicit call to set the mode on start-up, so it will be faster.
> >
> >
> > On Thu, Sep 20, 2012 at 5:38 PM, Joe Bowser <bo...@gmail.com> wrote:
> >
> >> - if (nativeToJsBridgeMode === undefined) {
> >> - if (callback.isAvailable()) {
> >> -
> >> androidExec.setNativeToJsBridgeMode(nativeToJsModes.HANGING_GET);
> >> - } else {
> >> -
> androidExec.setNativeToJsBridgeMode(nativeToJsModes.POLLING);
> >> - }
> >> - }
> >> + androidExec.setNativeToJsBridgeMode(nativeToJsModes.ONLINE_EVENT);
> >> +
> >>
> >> Seriously, I want to get a bunch of these "My app freezes when I go
> >> offline" errors gone, and it's easier if we don't have to tell users
> >> to switch the bridge.
> >>
> >> Joe
> >>
>
Re: [Android] Is it cool if I did this in cordova-js in lib/android/exec.js?
Posted by Joe Bowser <bo...@gmail.com>.
Um, it's both line 39. Is there somewhere else where I should change this?
On Thu, Sep 20, 2012 at 4:01 PM, Andrew Grieve <ag...@chromium.org> wrote:
> I think it'd be better to change the default value here:
> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/src/org/apache/cordova/NativeToJsMessageQueue.java;h=d2732c46213ac7ae786b5f1a850d42a078b2f6e4;hb=HEAD#l39
>
> and here:
> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/src/org/apache/cordova/NativeToJsMessageQueue.java;h=d2732c46213ac7ae786b5f1a850d42a078b2f6e4;hb=HEAD#l39
>
> And get rid of the line you just added:
> 69 function androidExec(success, fail, service, action, args) {
> 70 // Set default bridge modes if they have not already been set.
> 71 if (jsToNativeBridgeMode === undefined) {
> 72 androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
> 73 }
> 74 androidExec.setNativeToJsBridgeMode(nativeToJsModes.ONLINE_EVENT);
> <<<< THIS ONE
> 75
>
>
> Since that prevents anyone from setting it to anything else. :P
>
> Having the defaults set to it mean that there doesn't need to be an
> explicit call to set the mode on start-up, so it will be faster.
>
>
> On Thu, Sep 20, 2012 at 5:38 PM, Joe Bowser <bo...@gmail.com> wrote:
>
>> - if (nativeToJsBridgeMode === undefined) {
>> - if (callback.isAvailable()) {
>> -
>> androidExec.setNativeToJsBridgeMode(nativeToJsModes.HANGING_GET);
>> - } else {
>> - androidExec.setNativeToJsBridgeMode(nativeToJsModes.POLLING);
>> - }
>> - }
>> + androidExec.setNativeToJsBridgeMode(nativeToJsModes.ONLINE_EVENT);
>> +
>>
>> Seriously, I want to get a bunch of these "My app freezes when I go
>> offline" errors gone, and it's easier if we don't have to tell users
>> to switch the bridge.
>>
>> Joe
>>
Re: [Android] Is it cool if I did this in cordova-js in lib/android/exec.js?
Posted by Andrew Grieve <ag...@chromium.org>.
I think it'd be better to change the default value here:
https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/src/org/apache/cordova/NativeToJsMessageQueue.java;h=d2732c46213ac7ae786b5f1a850d42a078b2f6e4;hb=HEAD#l39
and here:
https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/src/org/apache/cordova/NativeToJsMessageQueue.java;h=d2732c46213ac7ae786b5f1a850d42a078b2f6e4;hb=HEAD#l39
And get rid of the line you just added:
69 function androidExec(success, fail, service, action, args) {
70 // Set default bridge modes if they have not already been set.
71 if (jsToNativeBridgeMode === undefined) {
72 androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
73 }
74 androidExec.setNativeToJsBridgeMode(nativeToJsModes.ONLINE_EVENT);
<<<< THIS ONE
75
Since that prevents anyone from setting it to anything else. :P
Having the defaults set to it mean that there doesn't need to be an
explicit call to set the mode on start-up, so it will be faster.
On Thu, Sep 20, 2012 at 5:38 PM, Joe Bowser <bo...@gmail.com> wrote:
> - if (nativeToJsBridgeMode === undefined) {
> - if (callback.isAvailable()) {
> -
> androidExec.setNativeToJsBridgeMode(nativeToJsModes.HANGING_GET);
> - } else {
> - androidExec.setNativeToJsBridgeMode(nativeToJsModes.POLLING);
> - }
> - }
> + androidExec.setNativeToJsBridgeMode(nativeToJsModes.ONLINE_EVENT);
> +
>
> Seriously, I want to get a bunch of these "My app freezes when I go
> offline" errors gone, and it's easier if we don't have to tell users
> to switch the bridge.
>
> Joe
>