CB-12895 : added eslint and removed eslint

This commit is contained in:
Audrey So
2017-06-12 11:15:35 -07:00
parent f9643daba0
commit 78691e43e1
11 changed files with 174 additions and 183 deletions
+17 -17
View File
@@ -18,23 +18,23 @@
*
*/
var exec = require('cordova/exec'),
cordova = require('cordova'),
channel = require('cordova/channel'),
utils = require('cordova/utils');
var exec = require('cordova/exec');
var cordova = require('cordova');
var channel = require('cordova/channel');
var utils = require('cordova/utils');
// 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.
// Browser platform do not need to define this property, because
// it is already supported by modern browsers
if (cordova.platformId !== 'browser' && typeof navigator != 'undefined') {
utils.defineGetter(navigator, 'onLine', function() {
return this.connection.type != 'none';
if (cordova.platformId !== 'browser' && typeof navigator !== 'undefined') {
utils.defineGetter(navigator, 'onLine', function () {
return this.connection.type !== 'none';
});
}
function NetworkConnection() {
function NetworkConnection () {
this.type = 'unknown';
}
@@ -44,8 +44,8 @@ function NetworkConnection() {
* @param {Function} successCallback The function to call when the Connection data is available
* @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
*/
NetworkConnection.prototype.getInfo = function(successCallback, errorCallback) {
exec(successCallback, errorCallback, "NetworkStatus", "getConnectionInfo", []);
NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) {
exec(successCallback, errorCallback, 'NetworkStatus', 'getConnectionInfo', []);
};
var me = new NetworkConnection();
@@ -55,13 +55,13 @@ var timeout = 500;
channel.createSticky('onCordovaConnectionReady');
channel.waitForInitialization('onCordovaConnectionReady');
channel.onCordovaReady.subscribe(function() {
me.getInfo(function(info) {
channel.onCordovaReady.subscribe(function () {
me.getInfo(function (info) {
me.type = info;
if (info === "none") {
if (info === 'none') {
// set a timer if still offline at the end of timer send the offline event
timerId = setTimeout(function(){
cordova.fireDocumentEvent("offline");
timerId = setTimeout(function () {
cordova.fireDocumentEvent('offline');
timerId = null;
}, timeout);
} else {
@@ -70,7 +70,7 @@ channel.onCordovaReady.subscribe(function() {
clearTimeout(timerId);
timerId = null;
}
cordova.fireDocumentEvent("online");
cordova.fireDocumentEvent('online');
}
// should only fire this once
@@ -84,7 +84,7 @@ channel.onCordovaReady.subscribe(function() {
if (channel.onCordovaConnectionReady.state !== 2) {
channel.onCordovaConnectionReady.fire();
}
console.log("Error initializing Network Connection: " + e);
console.log('Error initializing Network Connection: ' + e);
});
});