Ensure to lint as many files as possible (#854)

* Lint everything, including bins w/out extension

* Apply eslint --fix to all linted files

* Manually fix all remaining lint rule violations

* Remove ESLint inline config
This commit is contained in:
Raphael von der Grün 2019-10-21 18:26:17 +02:00 committed by GitHub
parent c35a990c09
commit 5dfa995a4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 147 additions and 153 deletions

View File

@ -16,8 +16,6 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
*/ */
/* eslint no-self-assign: 0 */
/* eslint no-unused-vars: 0 */
var Q = require('q'); var Q = require('q');
var fs = require('fs'); var fs = require('fs');
@ -356,7 +354,7 @@ function findOutputApksHelper (dir, build_type, arch) {
return true; return true;
}).sort(apkSorter); }).sort(apkSorter);
shellSilent = shellSilent; shell.config.silent = shellSilent;
if (ret.length === 0) { if (ret.length === 0) {
return ret; return ret;
@ -381,10 +379,6 @@ function findOutputApksHelper (dir, build_type, arch) {
// While replacing shell with fs-extra, it might be a good idea to see if we can // While replacing shell with fs-extra, it might be a good idea to see if we can
// generalise these findOutput methods. // generalise these findOutput methods.
function findOutputBundlesHelper (dir, build_type) { function findOutputBundlesHelper (dir, build_type) {
// This is an unused variable that was copied from findOutputApksHelper
// we are pretty sure it was meant to reset shell.config.silent back to
// the original value. However shell is planned to be replaced,
// it was left as is to avoid unintended consequences.
const shellSilent = shell.config.silent; const shellSilent = shell.config.silent;
shell.config.silent = true; shell.config.silent = true;
@ -404,6 +398,8 @@ function findOutputBundlesHelper (dir, build_type) {
return true; return true;
}); });
shell.config.silent = shellSilent;
return ret; return ret;
} }

View File

@ -16,7 +16,6 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
*/ */
/* eslint no-useless-escape: 0 */
var Q = require('q'); var Q = require('q');
var fs = require('fs'); var fs = require('fs');
@ -186,11 +185,11 @@ function updateProjectAccordingTo (platformConfig, locations) {
var strings = xmlHelpers.parseElementtreeSync(locations.strings); var strings = xmlHelpers.parseElementtreeSync(locations.strings);
var name = platformConfig.name(); var name = platformConfig.name();
strings.find('string[@name="app_name"]').text = name.replace(/\'/g, '\\\''); strings.find('string[@name="app_name"]').text = name.replace(/'/g, '\\\'');
var shortName = platformConfig.shortName && platformConfig.shortName(); var shortName = platformConfig.shortName && platformConfig.shortName();
if (shortName && shortName !== name) { if (shortName && shortName !== name) {
strings.find('string[@name="launcher_name"]').text = shortName.replace(/\'/g, '\\\''); strings.find('string[@name="launcher_name"]').text = shortName.replace(/'/g, '\\\'');
} }
fs.writeFileSync(locations.strings, strings.write({ indent: 4 }), 'utf-8'); fs.writeFileSync(locations.strings, strings.write({ indent: 4 }), 'utf-8');
@ -225,7 +224,7 @@ function updateProjectAccordingTo (platformConfig, locations) {
var destFile = path.join(locations.root, 'app', 'src', 'main', 'java', androidPkgName.replace(/\./g, '/'), path.basename(java_files[0])); var destFile = path.join(locations.root, 'app', 'src', 'main', 'java', androidPkgName.replace(/\./g, '/'), path.basename(java_files[0]));
shell.mkdir('-p', path.dirname(destFile)); shell.mkdir('-p', path.dirname(destFile));
shell.sed(/package [\w\.]*;/, 'package ' + androidPkgName + ';', java_files[0]).to(destFile); shell.sed(/package [\w.]*;/, 'package ' + androidPkgName + ';', java_files[0]).to(destFile);
events.emit('verbose', 'Wrote out Android package name "' + androidPkgName + '" to ' + destFile); events.emit('verbose', 'Wrote out Android package name "' + androidPkgName + '" to ' + destFile);
var removeOrigPkg = checkReqs.isWindows() || checkReqs.isDarwin() ? var removeOrigPkg = checkReqs.isWindows() || checkReqs.isDarwin() ?

View File

@ -20,7 +20,7 @@
*/ */
// Coho updates this line: // Coho updates this line:
var VERSION = "8.2.0-dev"; var VERSION = '8.2.0-dev';
module.exports.version = VERSION; module.exports.version = VERSION;

View File

@ -0,0 +1,4 @@
env:
node: false
commonjs: true
browser: true

View File

@ -25,12 +25,12 @@ var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativ
var currentApi = nativeApi; var currentApi = nativeApi;
module.exports = { module.exports = {
get: function() { return currentApi; }, get: function () { return currentApi; },
setPreferPrompt: function(value) { setPreferPrompt: function (value) {
currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi; currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi;
}, },
// Used only by tests. // Used only by tests.
set: function(value) { set: function (value) {
currentApi = value; currentApi = value;
} }
}; };

View File

@ -23,13 +23,13 @@
*/ */
module.exports = { module.exports = {
exec: function(bridgeSecret, service, action, callbackId, argsJson) { exec: function (bridgeSecret, service, action, callbackId, argsJson) {
return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId])); return prompt(argsJson, 'gap:' + JSON.stringify([bridgeSecret, service, action, callbackId]));
}, },
setNativeToJsBridgeMode: function(bridgeSecret, value) { setNativeToJsBridgeMode: function (bridgeSecret, value) {
prompt(value, 'gap_bridge_mode:' + bridgeSecret); prompt(value, 'gap_bridge_mode:' + bridgeSecret);
}, },
retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) { retrieveJsMessages: function (bridgeSecret, fromOnlineEvent) {
return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret); return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret);
} }
}; };

109
cordova-js-src/exec.js vendored
View File

@ -33,16 +33,16 @@
* @param {String} action Action to be run in cordova * @param {String} action Action to be run in cordova
* @param {String[]} [args] Zero or more arguments to pass to the method * @param {String[]} [args] Zero or more arguments to pass to the method
*/ */
var cordova = require('cordova'), var cordova = require('cordova');
nativeApiProvider = require('cordova/android/nativeapiprovider'), var nativeApiProvider = require('cordova/android/nativeapiprovider');
utils = require('cordova/utils'), var utils = require('cordova/utils');
base64 = require('cordova/base64'), var base64 = require('cordova/base64');
channel = require('cordova/channel'), var channel = require('cordova/channel');
jsToNativeModes = { var jsToNativeModes = {
PROMPT: 0, PROMPT: 0,
JS_OBJECT: 1 JS_OBJECT: 1
}, };
nativeToJsModes = { var nativeToJsModes = {
// Polls for messages using the JS->Native bridge. // Polls for messages using the JS->Native bridge.
POLLING: 0, POLLING: 0,
// For LOAD_URL to be viable, it would need to have a work-around for // For LOAD_URL to be viable, it would need to have a work-around for
@ -53,18 +53,18 @@ var cordova = require('cordova'),
// as set the navigator property itself. // as set the navigator property itself.
ONLINE_EVENT: 2, ONLINE_EVENT: 2,
EVAL_BRIDGE: 3 EVAL_BRIDGE: 3
}, };
jsToNativeBridgeMode, // Set lazily. var jsToNativeBridgeMode; // Set lazily.
nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE, var nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE;
pollEnabled = false, var pollEnabled = false;
bridgeSecret = -1; var bridgeSecret = -1;
var messagesFromNative = []; var messagesFromNative = [];
var isProcessing = false; var isProcessing = false;
var resolvedPromise = typeof Promise == 'undefined' ? null : Promise.resolve(); var resolvedPromise = typeof Promise === 'undefined' ? null : Promise.resolve();
var nextTick = resolvedPromise ? function(fn) { resolvedPromise.then(fn); } : function(fn) { setTimeout(fn); }; var nextTick = resolvedPromise ? function (fn) { resolvedPromise.then(fn); } : function (fn) { setTimeout(fn); };
function androidExec(success, fail, service, action, args) { function androidExec (success, fail, service, action, args) {
if (bridgeSecret < 0) { if (bridgeSecret < 0) {
// If we ever catch this firing, we'll need to queue up exec()s // If we ever catch this firing, we'll need to queue up exec()s
// and fire them once we get a secret. For now, I don't think // and fire them once we get a secret. For now, I don't think
@ -83,21 +83,21 @@ function androidExec(success, fail, service, action, args) {
// Process any ArrayBuffers in the args into a string. // Process any ArrayBuffers in the args into a string.
for (var i = 0; i < args.length; i++) { for (var i = 0; i < args.length; i++) {
if (utils.typeName(args[i]) == 'ArrayBuffer') { if (utils.typeName(args[i]) === 'ArrayBuffer') {
args[i] = base64.fromArrayBuffer(args[i]); args[i] = base64.fromArrayBuffer(args[i]);
} }
} }
var callbackId = service + cordova.callbackId++, var callbackId = service + cordova.callbackId++;
argsJson = JSON.stringify(args); var argsJson = JSON.stringify(args);
if (success || fail) { if (success || fail) {
cordova.callbacks[callbackId] = {success:success, fail:fail}; cordova.callbacks[callbackId] = { success: success, fail: fail };
} }
var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson); var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson);
// If argsJson was received by Java as null, try again with the PROMPT bridge mode. // If argsJson was received by Java as null, try again with the PROMPT bridge mode.
// This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2. See CB-2666. // This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2. See CB-2666.
if (jsToNativeBridgeMode == jsToNativeModes.JS_OBJECT && msgs === "@Null arguments.") { if (jsToNativeBridgeMode === jsToNativeModes.JS_OBJECT && msgs === '@Null arguments.') {
androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT); androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
androidExec(success, fail, service, action, args); androidExec(success, fail, service, action, args);
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
@ -108,16 +108,16 @@ function androidExec(success, fail, service, action, args) {
} }
} }
androidExec.init = function() { androidExec.init = function () {
bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode); bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
channel.onNativeReady.fire(); channel.onNativeReady.fire();
}; };
function pollOnceFromOnlineEvent() { function pollOnceFromOnlineEvent () {
pollOnce(true); pollOnce(true);
} }
function pollOnce(opt_fromOnlineEvent) { function pollOnce (opt_fromOnlineEvent) {
if (bridgeSecret < 0) { if (bridgeSecret < 0) {
// This can happen when the NativeToJsMessageQueue resets the online state on page transitions. // This can happen when the NativeToJsMessageQueue resets the online state on page transitions.
// We know there's nothing to retrieve, so no need to poll. // We know there's nothing to retrieve, so no need to poll.
@ -131,15 +131,15 @@ function pollOnce(opt_fromOnlineEvent) {
} }
} }
function pollingTimerFunc() { function pollingTimerFunc () {
if (pollEnabled) { if (pollEnabled) {
pollOnce(); pollOnce();
setTimeout(pollingTimerFunc, 50); setTimeout(pollingTimerFunc, 50);
} }
} }
function hookOnlineApis() { function hookOnlineApis () {
function proxyEvent(e) { function proxyEvent (e) {
cordova.fireWindowEvent(e.type); cordova.fireWindowEvent(e.type);
} }
// The network module takes care of firing online and offline events. // The network module takes care of firing online and offline events.
@ -159,19 +159,19 @@ hookOnlineApis();
androidExec.jsToNativeModes = jsToNativeModes; androidExec.jsToNativeModes = jsToNativeModes;
androidExec.nativeToJsModes = nativeToJsModes; androidExec.nativeToJsModes = nativeToJsModes;
androidExec.setJsToNativeBridgeMode = function(mode) { androidExec.setJsToNativeBridgeMode = function (mode) {
if (mode == jsToNativeModes.JS_OBJECT && !window._cordovaNative) { if (mode === jsToNativeModes.JS_OBJECT && !window._cordovaNative) {
mode = jsToNativeModes.PROMPT; mode = jsToNativeModes.PROMPT;
} }
nativeApiProvider.setPreferPrompt(mode == jsToNativeModes.PROMPT); nativeApiProvider.setPreferPrompt(mode === jsToNativeModes.PROMPT);
jsToNativeBridgeMode = mode; jsToNativeBridgeMode = mode;
}; };
androidExec.setNativeToJsBridgeMode = function(mode) { androidExec.setNativeToJsBridgeMode = function (mode) {
if (mode == nativeToJsBridgeMode) { if (mode === nativeToJsBridgeMode) {
return; return;
} }
if (nativeToJsBridgeMode == nativeToJsModes.POLLING) { if (nativeToJsBridgeMode === nativeToJsModes.POLLING) {
pollEnabled = false; pollEnabled = false;
} }
@ -182,32 +182,32 @@ androidExec.setNativeToJsBridgeMode = function(mode) {
nativeApiProvider.get().setNativeToJsBridgeMode(bridgeSecret, mode); nativeApiProvider.get().setNativeToJsBridgeMode(bridgeSecret, mode);
} }
if (mode == nativeToJsModes.POLLING) { if (mode === nativeToJsModes.POLLING) {
pollEnabled = true; pollEnabled = true;
setTimeout(pollingTimerFunc, 1); setTimeout(pollingTimerFunc, 1);
} }
}; };
function buildPayload(payload, message) { function buildPayload (payload, message) {
var payloadKind = message.charAt(0); var payloadKind = message.charAt(0);
if (payloadKind == 's') { if (payloadKind === 's') {
payload.push(message.slice(1)); payload.push(message.slice(1));
} else if (payloadKind == 't') { } else if (payloadKind === 't') {
payload.push(true); payload.push(true);
} else if (payloadKind == 'f') { } else if (payloadKind === 'f') {
payload.push(false); payload.push(false);
} else if (payloadKind == 'N') { } else if (payloadKind === 'N') {
payload.push(null); payload.push(null);
} else if (payloadKind == 'n') { } else if (payloadKind === 'n') {
payload.push(+message.slice(1)); payload.push(+message.slice(1));
} else if (payloadKind == 'A') { } else if (payloadKind === 'A') {
var data = message.slice(1); var data = message.slice(1);
payload.push(base64.toArrayBuffer(data)); payload.push(base64.toArrayBuffer(data));
} else if (payloadKind == 'S') { } else if (payloadKind === 'S') {
payload.push(window.atob(message.slice(1))); payload.push(window.atob(message.slice(1)));
} else if (payloadKind == 'M') { } else if (payloadKind === 'M') {
var multipartMessages = message.slice(1); var multipartMessages = message.slice(1);
while (multipartMessages !== "") { while (multipartMessages !== '') {
var spaceIdx = multipartMessages.indexOf(' '); var spaceIdx = multipartMessages.indexOf(' ');
var msgLen = +multipartMessages.slice(0, spaceIdx); var msgLen = +multipartMessages.slice(0, spaceIdx);
var multipartMessage = multipartMessages.substr(spaceIdx + 1, msgLen); var multipartMessage = multipartMessages.substr(spaceIdx + 1, msgLen);
@ -220,14 +220,15 @@ function buildPayload(payload, message) {
} }
// Processes a single message, as encoded by NativeToJsMessageQueue.java. // Processes a single message, as encoded by NativeToJsMessageQueue.java.
function processMessage(message) { function processMessage (message) {
var firstChar = message.charAt(0); var firstChar = message.charAt(0);
if (firstChar == 'J') { if (firstChar === 'J') {
// This is deprecated on the .java side. It doesn't work with CSP enabled. // This is deprecated on the .java side. It doesn't work with CSP enabled.
// eslint-disable-next-line no-eval
eval(message.slice(1)); eval(message.slice(1));
} else if (firstChar == 'S' || firstChar == 'F') { } else if (firstChar === 'S' || firstChar === 'F') {
var success = firstChar == 'S'; var success = firstChar === 'S';
var keepCallback = message.charAt(1) == '1'; var keepCallback = message.charAt(1) === '1';
var spaceIdx = message.indexOf(' ', 2); var spaceIdx = message.indexOf(' ', 2);
var status = +message.slice(2, spaceIdx); var status = +message.slice(2, spaceIdx);
var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1); var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1);
@ -237,11 +238,11 @@ function processMessage(message) {
buildPayload(payload, payloadMessage); buildPayload(payload, payloadMessage);
cordova.callbackFromNative(callbackId, success, status, payload, keepCallback); cordova.callbackFromNative(callbackId, success, status, payload, keepCallback);
} else { } else {
console.log("processMessage failed: invalid message: " + JSON.stringify(message)); console.log('processMessage failed: invalid message: ' + JSON.stringify(message));
} }
} }
function processMessages() { function processMessages () {
// Check for the reentrant case. // Check for the reentrant case.
if (isProcessing) { if (isProcessing) {
return; return;
@ -254,7 +255,7 @@ function processMessages() {
var msg = popMessageFromQueue(); var msg = popMessageFromQueue();
// The Java side can send a * message to indicate that it // The Java side can send a * message to indicate that it
// still has messages waiting to be retrieved. // still has messages waiting to be retrieved.
if (msg == '*' && messagesFromNative.length === 0) { if (msg === '*' && messagesFromNative.length === 0) {
nextTick(pollOnce); nextTick(pollOnce);
return; return;
} }
@ -267,9 +268,9 @@ function processMessages() {
} }
} }
function popMessageFromQueue() { function popMessageFromQueue () {
var messageBatch = messagesFromNative.shift(); var messageBatch = messagesFromNative.shift();
if (messageBatch == '*') { if (messageBatch === '*') {
return '*'; return '*';
} }

View File

@ -24,11 +24,11 @@ var lastResumeEvent = null;
module.exports = { module.exports = {
id: 'android', id: 'android',
bootstrap: function() { bootstrap: function () {
var channel = require('cordova/channel'), var channel = require('cordova/channel');
cordova = require('cordova'), var cordova = require('cordova');
exec = require('cordova/exec'), var exec = require('cordova/exec');
modulemapper = require('cordova/modulemapper'); var modulemapper = require('cordova/modulemapper');
// Get the shared secret needed to use the bridge. // Get the shared secret needed to use the bridge.
exec.init(); exec.init();
@ -40,21 +40,21 @@ module.exports = {
// Inject a listener for the backbutton on the document. // Inject a listener for the backbutton on the document.
var backButtonChannel = cordova.addDocumentEventHandler('backbutton'); var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
backButtonChannel.onHasSubscribersChange = function() { backButtonChannel.onHasSubscribersChange = function () {
// If we just attached the first handler or detached the last handler, // If we just attached the first handler or detached the last handler,
// let native know we need to override the back button. // let native know we need to override the back button.
exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [this.numHandlers == 1]); exec(null, null, APP_PLUGIN_NAME, 'overrideBackbutton', [this.numHandlers === 1]);
}; };
// Add hardware MENU and SEARCH button handlers // Add hardware MENU and SEARCH button handlers
cordova.addDocumentEventHandler('menubutton'); cordova.addDocumentEventHandler('menubutton');
cordova.addDocumentEventHandler('searchbutton'); cordova.addDocumentEventHandler('searchbutton');
function bindButtonChannel(buttonName) { function bindButtonChannel (buttonName) {
// generic button bind used for volumeup/volumedown buttons // generic button bind used for volumeup/volumedown buttons
var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button'); var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button');
volumeButtonChannel.onHasSubscribersChange = function() { volumeButtonChannel.onHasSubscribersChange = function () {
exec(null, null, APP_PLUGIN_NAME, "overrideButton", [buttonName, this.numHandlers == 1]); exec(null, null, APP_PLUGIN_NAME, 'overrideButton', [buttonName, this.numHandlers === 1]);
}; };
} }
// Inject a listener for the volume buttons on the document. // Inject a listener for the volume buttons on the document.
@ -66,7 +66,7 @@ module.exports = {
// plugin result is delivered even after the event is fired (CB-10498) // plugin result is delivered even after the event is fired (CB-10498)
var cordovaAddEventListener = document.addEventListener; var cordovaAddEventListener = document.addEventListener;
document.addEventListener = function(evt, handler, capture) { document.addEventListener = function (evt, handler, capture) {
cordovaAddEventListener(evt, handler, capture); cordovaAddEventListener(evt, handler, capture);
if (evt === 'resume' && lastResumeEvent) { if (evt === 'resume' && lastResumeEvent) {
@ -76,38 +76,35 @@ module.exports = {
// Let native code know we are all done on the JS side. // Let native code know we are all done on the JS side.
// Native code will then un-hide the WebView. // Native code will then un-hide the WebView.
channel.onCordovaReady.subscribe(function() { channel.onCordovaReady.subscribe(function () {
exec(onMessageFromNative, null, APP_PLUGIN_NAME, 'messageChannel', []); exec(onMessageFromNative, null, APP_PLUGIN_NAME, 'messageChannel', []);
exec(null, null, APP_PLUGIN_NAME, "show", []); exec(null, null, APP_PLUGIN_NAME, 'show', []);
}); });
} }
}; };
function onMessageFromNative(msg) { function onMessageFromNative (msg) {
var cordova = require('cordova'); var cordova = require('cordova');
var action = msg.action; var action = msg.action;
switch (action) switch (action) {
{ // pause and resume are Android app life cycle events
// Button events
case 'backbutton': case 'backbutton':
case 'menubutton': case 'menubutton':
case 'searchbutton': case 'searchbutton':
// App life cycle events
case 'pause': case 'pause':
// Volume events
case 'volumedownbutton': case 'volumedownbutton':
case 'volumeupbutton': case 'volumeupbutton':
cordova.fireDocumentEvent(action); cordova.fireDocumentEvent(action);
break; break;
case 'resume': case 'resume':
if(arguments.length > 1 && msg.pendingResult) { if (arguments.length > 1 && msg.pendingResult) {
if(arguments.length === 2) { if (arguments.length === 2) {
msg.pendingResult.result = arguments[1]; msg.pendingResult.result = arguments[1];
} else { } else {
// The plugin returned a multipart message // The plugin returned a multipart message
var res = []; var res = [];
for(var i = 1; i < arguments.length; i++) { for (var i = 1; i < arguments.length; i++) {
res.push(arguments[i]); res.push(arguments[i]);
} }
msg.pendingResult.result = res; msg.pendingResult.result = res;

View File

@ -26,8 +26,8 @@ module.exports = {
/** /**
* Clear the resource cache. * Clear the resource cache.
*/ */
clearCache:function() { clearCache: function () {
exec(null, null, APP_PLUGIN_NAME, "clearCache", []); exec(null, null, APP_PLUGIN_NAME, 'clearCache', []);
}, },
/** /**
@ -44,31 +44,31 @@ module.exports = {
* Example: * Example:
* navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
*/ */
loadUrl:function(url, props) { loadUrl: function (url, props) {
exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]); exec(null, null, APP_PLUGIN_NAME, 'loadUrl', [url, props]);
}, },
/** /**
* Cancel loadUrl that is waiting to be loaded. * Cancel loadUrl that is waiting to be loaded.
*/ */
cancelLoadUrl:function() { cancelLoadUrl: function () {
exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []); exec(null, null, APP_PLUGIN_NAME, 'cancelLoadUrl', []);
}, },
/** /**
* Clear web history in this web view. * Clear web history in this web view.
* Instead of BACK button loading the previous web page, it will exit the app. * Instead of BACK button loading the previous web page, it will exit the app.
*/ */
clearHistory:function() { clearHistory: function () {
exec(null, null, APP_PLUGIN_NAME, "clearHistory", []); exec(null, null, APP_PLUGIN_NAME, 'clearHistory', []);
}, },
/** /**
* Go to previous page displayed. * Go to previous page displayed.
* This is the same as pressing the backbutton on Android device. * This is the same as pressing the backbutton on Android device.
*/ */
backHistory:function() { backHistory: function () {
exec(null, null, APP_PLUGIN_NAME, "backHistory", []); exec(null, null, APP_PLUGIN_NAME, 'backHistory', []);
}, },
/** /**
@ -80,8 +80,8 @@ module.exports = {
* *
* @param override T=override, F=cancel override * @param override T=override, F=cancel override
*/ */
overrideBackbutton:function(override) { overrideBackbutton: function (override) {
exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]); exec(null, null, APP_PLUGIN_NAME, 'overrideBackbutton', [override]);
}, },
/** /**
@ -95,14 +95,14 @@ module.exports = {
* @param button volumeup, volumedown * @param button volumeup, volumedown
* @param override T=override, F=cancel override * @param override T=override, F=cancel override
*/ */
overrideButton:function(button, override) { overrideButton: function (button, override) {
exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]); exec(null, null, APP_PLUGIN_NAME, 'overrideButton', [button, override]);
}, },
/** /**
* Exit and terminate the application. * Exit and terminate the application.
*/ */
exitApp:function() { exitApp: function () {
return exec(null, null, APP_PLUGIN_NAME, "exitApp", []); return exec(null, null, APP_PLUGIN_NAME, 'exitApp', []);
} }
}; };

View File

@ -24,7 +24,7 @@
"cover": "nyc jasmine --config=spec/coverage.json", "cover": "nyc jasmine --config=spec/coverage.json",
"e2e-tests": "jasmine --config=spec/e2e/jasmine.json", "e2e-tests": "jasmine --config=spec/e2e/jasmine.json",
"java-unit-tests": "node test/run_java_unit_tests.js", "java-unit-tests": "node test/run_java_unit_tests.js",
"eslint": "eslint bin spec test" "eslint": "eslint . \"bin/**/!(*.*|gitignore)\""
}, },
"author": "Apache Software Foundation", "author": "Apache Software Foundation",
"license": "Apache-2.0", "license": "Apache-2.0",

View File

@ -260,13 +260,10 @@ describe('android project handler', function () {
}); });
describe('of <asset> elements', function () { describe('of <asset> elements', function () {
var asset = { src: 'www/dummyPlugin.js', target: 'foo/dummy.js' }; var asset;
var wwwDest; /* eslint no-unused-vars: "off" */
var platformWwwDest; /* eslint no-unused-vars: "off" */
beforeEach(function () { beforeEach(function () {
wwwDest = path.resolve(dummyProject.www, asset.target); asset = { src: 'www/dummyPlugin.js', target: 'foo/dummy.js' };
platformWwwDest = path.resolve(dummyProject.platformWww, asset.target);
}); });
it('Test#015 : should put asset to both www and platform_www when options.usePlatformWww flag is specified', function () { it('Test#015 : should put asset to both www and platform_www when options.usePlatformWww flag is specified', function () {