incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-1368) Move navigator.connection.network interface to navigator.network and make navigator.onLine be based off of network type.
Date Tue, 04 Sep 2012 15:16:08 GMT
Andrew Grieve created CB-1368:
---------------------------------

             Summary: Move navigator.connection.network interface to navigator.network and
make navigator.onLine be based off of network type.
                 Key: CB-1368
                 URL: https://issues.apache.org/jira/browse/CB-1368
             Project: Apache Cordova
          Issue Type: Bug
          Components: CordovaJS
            Reporter: Andrew Grieve
            Assignee: Andrew Grieve
            Priority: Minor
             Fix For: 2.2.0


According to: http://www.w3.org/TR/netinfo-api/
navigator.connection.network should actually be navigator.network.

The difficulty before was figuring out how to clobber navigator's own properties with our
own, but the following code can be used to achieve this:

function ClassWithNavigatorAsPrototype() {}
ClassWithNavigatorAsPrototype.prototype = navigator;
var newNavigator = new ClassWithNavigatorAsPrototype();

This also allows us to set a consistent onLine property:

newNavigator.__defineGetter__('onLine', function() {
    return this.network.type != 'none';
});



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message