You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Drew Walters <de...@gmail.com> on 2012/03/07 18:36:54 UTC

Network online/offline events on document or window?

Looks like cordova-js has changed the online/offline network events to
fire on the window instead of document:

cordova-js uses cordova.fireWindowEvent:
    https://github.com/apache/incubator-cordova-js/blob/master/lib/plugin/network.js

Old implementations used Cordova.fireDocumentEvent:
    https://github.com/apache/incubator-cordova-android/blob/master/framework/assets/js/network.js
    https://github.com/apache/incubator-cordova-blackberry-webworks/blob/master/javascript/network.js

Was this intentional?  I can't tell from the published version of the
spec which is correct:
    http://www.w3.org/TR/2011/WD-netinfo-api-20110607/

Re: Network online/offline events on document or window?

Posted by Filip Maj <fi...@adobe.com>.
Looks like docs specify they should be on document:

http://docs.phonegap.com/en/1.5.0/phonegap_events_events.md.html#online


Very very likely I messed up :)

I will patch shortly.

Good catch!

On 3/7/12 9:36 AM, "Drew Walters" <de...@gmail.com> wrote:

>Looks like cordova-js has changed the online/offline network events to
>fire on the window instead of document:
>
>cordova-js uses cordova.fireWindowEvent:
>    
>https://github.com/apache/incubator-cordova-js/blob/master/lib/plugin/netw
>ork.js
>
>Old implementations used Cordova.fireDocumentEvent:
>    
>https://github.com/apache/incubator-cordova-android/blob/master/framework/
>assets/js/network.js
>    
>https://github.com/apache/incubator-cordova-blackberry-webworks/blob/maste
>r/javascript/network.js
>
>Was this intentional?  I can't tell from the published version of the
>spec which is correct:
>    http://www.w3.org/TR/2011/WD-netinfo-api-20110607/