CB-8185 Use navigator.onLine as connection information source on browser platform

* add support for `online`/`offline` events for browser
This commit is contained in:
Vladimir Kotikov
2015-02-04 17:09:06 +03:00
parent daedbf68ad
commit a8c5507853
5 changed files with 103 additions and 56 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ var exec = require('cordova/exec'),
// Link the onLine property with the Cordova-supplied network info.
// This works because we clobber the navigator object with our own
// object in bootstrap.js.
if (typeof navigator != 'undefined') {
// Browser platform do not need to define this property, because
// it is already supported by modern browsers
if (cordova.platforId !== 'browser' && typeof navigator != 'undefined') {
utils.defineGetter(navigator, 'onLine', function() {
return this.connection.type != 'none';
});