mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 03:53:09 +08:00
Update JS snapshot to version 6.5.0-dev (via coho)
This commit is contained in:
parent
05aeaf1bd2
commit
83601dca2f
253
bin/templates/project/assets/www/cordova.js
vendored
253
bin/templates/project/assets/www/cordova.js
vendored
@ -1,6 +1,5 @@
|
||||
/* eslint-disable */
|
||||
// Platform: android
|
||||
// 74a4adc2d0fddb1e0cfb9be1961494ef0afc9893
|
||||
// 4450a4cea50616e080a82e8ede9e3d6a1fe3c3ec
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@ -20,31 +19,29 @@
|
||||
under the License.
|
||||
*/
|
||||
;(function() {
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '6.4.0-dev';
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '6.5.0-dev';
|
||||
// file: src/scripts/require.js
|
||||
|
||||
/* jshint -W079 */
|
||||
/* jshint -W020 */
|
||||
|
||||
var require,
|
||||
define;
|
||||
var require;
|
||||
var define;
|
||||
|
||||
(function () {
|
||||
var modules = {},
|
||||
var modules = {};
|
||||
// Stack of moduleIds currently being built.
|
||||
requireStack = [],
|
||||
var requireStack = [];
|
||||
// Map of module ID -> index into requireStack of modules currently being built.
|
||||
inProgressModules = {},
|
||||
SEPARATOR = ".";
|
||||
|
||||
|
||||
var inProgressModules = {};
|
||||
var SEPARATOR = '.';
|
||||
|
||||
function build (module) {
|
||||
var factory = module.factory,
|
||||
localRequire = function (id) {
|
||||
var factory = module.factory;
|
||||
var localRequire = function (id) {
|
||||
var resultantId = id;
|
||||
// Its a relative path, so lop off the last portion and add the id (minus "./")
|
||||
if (id.charAt(0) === ".") {
|
||||
if (id.charAt(0) === '.') {
|
||||
resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
|
||||
}
|
||||
return require(resultantId);
|
||||
@ -57,10 +54,10 @@ var require,
|
||||
|
||||
require = function (id) {
|
||||
if (!modules[id]) {
|
||||
throw "module " + id + " not found";
|
||||
throw 'module ' + id + ' not found';
|
||||
} else if (id in inProgressModules) {
|
||||
var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
|
||||
throw "Cycle in require graph: " + cycle;
|
||||
throw 'Cycle in require graph: ' + cycle;
|
||||
}
|
||||
if (modules[id].factory) {
|
||||
try {
|
||||
@ -77,7 +74,7 @@ var require,
|
||||
|
||||
define = function (id, factory) {
|
||||
if (modules[id]) {
|
||||
throw "module " + id + " already defined";
|
||||
throw 'module ' + id + ' already defined';
|
||||
}
|
||||
|
||||
modules[id] = {
|
||||
@ -94,7 +91,7 @@ var require,
|
||||
})();
|
||||
|
||||
// Export for use in node
|
||||
if (typeof module === "object" && typeof require === "function") {
|
||||
if (typeof module === 'object' && typeof require === 'function') {
|
||||
module.exports.require = require;
|
||||
module.exports.define = define;
|
||||
}
|
||||
@ -104,15 +101,13 @@ define("cordova", function(require, exports, module) {
|
||||
|
||||
// Workaround for Windows 10 in hosted environment case
|
||||
// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object
|
||||
if (window.cordova && !(window.cordova instanceof HTMLElement)) {
|
||||
throw new Error("cordova already defined");
|
||||
if (window.cordova && !(window.cordova instanceof HTMLElement)) { // eslint-disable-line no-undef
|
||||
throw new Error('cordova already defined');
|
||||
}
|
||||
|
||||
|
||||
var channel = require('cordova/channel');
|
||||
var platform = require('cordova/platform');
|
||||
|
||||
|
||||
/**
|
||||
* Intercept calls to addEventListener + removeEventListener and handle deviceready,
|
||||
* resume, and pause events.
|
||||
@ -125,12 +120,12 @@ var m_window_removeEventListener = window.removeEventListener;
|
||||
/**
|
||||
* Houses custom event handlers to intercept on document + window event listeners.
|
||||
*/
|
||||
var documentEventHandlers = {},
|
||||
windowEventHandlers = {};
|
||||
var documentEventHandlers = {};
|
||||
var windowEventHandlers = {};
|
||||
|
||||
document.addEventListener = function (evt, handler, capture) {
|
||||
var e = evt.toLowerCase();
|
||||
if (typeof documentEventHandlers[e] != 'undefined') {
|
||||
if (typeof documentEventHandlers[e] !== 'undefined') {
|
||||
documentEventHandlers[e].subscribe(handler);
|
||||
} else {
|
||||
m_document_addEventListener.call(document, evt, handler, capture);
|
||||
@ -139,7 +134,7 @@ document.addEventListener = function(evt, handler, capture) {
|
||||
|
||||
window.addEventListener = function (evt, handler, capture) {
|
||||
var e = evt.toLowerCase();
|
||||
if (typeof windowEventHandlers[e] != 'undefined') {
|
||||
if (typeof windowEventHandlers[e] !== 'undefined') {
|
||||
windowEventHandlers[e].subscribe(handler);
|
||||
} else {
|
||||
m_window_addEventListener.call(window, evt, handler, capture);
|
||||
@ -149,7 +144,7 @@ window.addEventListener = function(evt, handler, capture) {
|
||||
document.removeEventListener = function (evt, handler, capture) {
|
||||
var e = evt.toLowerCase();
|
||||
// If unsubscribing from an event that is handled by a plugin
|
||||
if (typeof documentEventHandlers[e] != "undefined") {
|
||||
if (typeof documentEventHandlers[e] !== 'undefined') {
|
||||
documentEventHandlers[e].unsubscribe(handler);
|
||||
} else {
|
||||
m_document_removeEventListener.call(document, evt, handler, capture);
|
||||
@ -159,7 +154,7 @@ document.removeEventListener = function(evt, handler, capture) {
|
||||
window.removeEventListener = function (evt, handler, capture) {
|
||||
var e = evt.toLowerCase();
|
||||
// If unsubscribing from an event that is handled by a plugin
|
||||
if (typeof windowEventHandlers[e] != "undefined") {
|
||||
if (typeof windowEventHandlers[e] !== 'undefined') {
|
||||
windowEventHandlers[e].unsubscribe(handler);
|
||||
} else {
|
||||
m_window_removeEventListener.call(window, evt, handler, capture);
|
||||
@ -179,13 +174,16 @@ function createEvent(type, data) {
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
var cordova = {
|
||||
define: define,
|
||||
require: require,
|
||||
version: PLATFORM_VERSION_BUILD_LABEL,
|
||||
platformVersion: PLATFORM_VERSION_BUILD_LABEL,
|
||||
platformId: platform.id,
|
||||
|
||||
/* eslint-enable no-undef */
|
||||
|
||||
/**
|
||||
* Methods to add/remove your own addEventListener hijacking on document + window.
|
||||
*/
|
||||
@ -219,14 +217,13 @@ var cordova = {
|
||||
*/
|
||||
fireDocumentEvent: function (type, data, bNoDetach) {
|
||||
var evt = createEvent(type, data);
|
||||
if (typeof documentEventHandlers[type] != 'undefined') {
|
||||
if (typeof documentEventHandlers[type] !== 'undefined') {
|
||||
if (bNoDetach) {
|
||||
documentEventHandlers[type].fire(evt);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
// Fire deviceready on listeners that were registered before cordova.js was loaded.
|
||||
if (type == 'deviceready') {
|
||||
if (type === 'deviceready') {
|
||||
document.dispatchEvent(evt);
|
||||
}
|
||||
documentEventHandlers[type].fire(evt);
|
||||
@ -238,7 +235,7 @@ var cordova = {
|
||||
},
|
||||
fireWindowEvent: function (type, data) {
|
||||
var evt = createEvent(type, data);
|
||||
if (typeof windowEventHandlers[type] != 'undefined') {
|
||||
if (typeof windowEventHandlers[type] !== 'undefined') {
|
||||
setTimeout(function () {
|
||||
windowEventHandlers[type].fire(evt);
|
||||
}, 0);
|
||||
@ -290,7 +287,7 @@ var cordova = {
|
||||
try {
|
||||
var callback = cordova.callbacks[callbackId];
|
||||
if (callback) {
|
||||
if (isSuccess && status == cordova.callbackStatus.OK) {
|
||||
if (isSuccess && status === cordova.callbackStatus.OK) {
|
||||
callback.success && callback.success.apply(null, args);
|
||||
} else if (!isSuccess) {
|
||||
callback.fail && callback.fail.apply(null, args);
|
||||
@ -307,11 +304,10 @@ var cordova = {
|
||||
delete cordova.callbacks[callbackId];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
var msg = "Error in " + (isSuccess ? "Success" : "Error") + " callbackId: " + callbackId + " : " + err;
|
||||
} catch (err) {
|
||||
var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
|
||||
console && console.log && console.log(msg);
|
||||
cordova.fireWindowEvent("cordovacallbackerror", { 'message': msg });
|
||||
cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
@ -320,13 +316,12 @@ var cordova = {
|
||||
try {
|
||||
func();
|
||||
} catch (e) {
|
||||
console.log("Failed to run constructor: " + e);
|
||||
console.log('Failed to run constructor: ' + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
module.exports = cordova;
|
||||
|
||||
});
|
||||
@ -403,18 +398,18 @@ function checkArgs(spec, functionName, args, opt_callee) {
|
||||
var errMsg = null;
|
||||
var typeName;
|
||||
for (var i = 0; i < spec.length; ++i) {
|
||||
var c = spec.charAt(i),
|
||||
cUpper = c.toUpperCase(),
|
||||
arg = args[i];
|
||||
var c = spec.charAt(i);
|
||||
var cUpper = c.toUpperCase();
|
||||
var arg = args[i];
|
||||
// Asterix means allow anything.
|
||||
if (c == '*') {
|
||||
if (c === '*') {
|
||||
continue;
|
||||
}
|
||||
typeName = utils.typeName(arg);
|
||||
if ((arg === null || arg === undefined) && c == cUpper) {
|
||||
if ((arg === null || arg === undefined) && c === cUpper) {
|
||||
continue;
|
||||
}
|
||||
if (typeName != typeMap[cUpper]) {
|
||||
if (typeName !== typeMap[cUpper]) {
|
||||
errMsg = 'Expected ' + typeMap[cUpper];
|
||||
break;
|
||||
}
|
||||
@ -423,7 +418,7 @@ function checkArgs(spec, functionName, args, opt_callee) {
|
||||
errMsg += ', but got ' + typeName + '.';
|
||||
errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
|
||||
// Don't log when running unit tests.
|
||||
if (typeof jasmine == 'undefined') {
|
||||
if (typeof jasmine === 'undefined') {
|
||||
console.error(errMsg);
|
||||
}
|
||||
throw TypeError(errMsg);
|
||||
@ -438,7 +433,6 @@ moduleExports.checkArgs = checkArgs;
|
||||
moduleExports.getValue = getValue;
|
||||
moduleExports.enableChecks = true;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// file: src/common/base64.js
|
||||
@ -452,7 +446,7 @@ base64.fromArrayBuffer = function(arrayBuffer) {
|
||||
};
|
||||
|
||||
base64.toArrayBuffer = function (str) {
|
||||
var decodedStr = typeof atob != 'undefined' ? atob(str) : new Buffer(str,'base64').toString('binary');
|
||||
var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef
|
||||
var arrayBuffer = new ArrayBuffer(decodedStr.length);
|
||||
var array = new Uint8Array(arrayBuffer);
|
||||
for (var i = 0, len = decodedStr.length; i < len; i++) {
|
||||
@ -468,7 +462,7 @@ base64.toArrayBuffer = function(str) {
|
||||
* platforms tested.
|
||||
*/
|
||||
|
||||
var b64_6bit = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
var b64_12bit;
|
||||
|
||||
var b64_12bitTable = function () {
|
||||
@ -484,7 +478,7 @@ var b64_12bitTable = function() {
|
||||
|
||||
function uint8ToBase64 (rawData) {
|
||||
var numBytes = rawData.byteLength;
|
||||
var output="";
|
||||
var output = '';
|
||||
var segment;
|
||||
var table = b64_12bitTable();
|
||||
for (var i = 0; i < numBytes - 2; i += 3) {
|
||||
@ -492,12 +486,12 @@ function uint8ToBase64(rawData) {
|
||||
output += table[segment >> 12];
|
||||
output += table[segment & 0xfff];
|
||||
}
|
||||
if (numBytes - i == 2) {
|
||||
if (numBytes - i === 2) {
|
||||
segment = (rawData[i] << 16) + (rawData[i + 1] << 8);
|
||||
output += table[segment >> 12];
|
||||
output += b64_6bit[(segment & 0xfff) >> 6];
|
||||
output += '=';
|
||||
} else if (numBytes - i == 1) {
|
||||
} else if (numBytes - i === 1) {
|
||||
segment = (rawData[i] << 16);
|
||||
output += table[segment >> 12];
|
||||
output += '==';
|
||||
@ -569,7 +563,7 @@ function include(parent, objects, clobber, merge) {
|
||||
result = parent[key];
|
||||
} else {
|
||||
// Overwrite if not currently defined.
|
||||
if (typeof parent[key] == 'undefined') {
|
||||
if (typeof parent[key] === 'undefined') {
|
||||
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
|
||||
} else {
|
||||
// Set result to what already exists, so we can build children into it if they exist.
|
||||
@ -628,8 +622,8 @@ exports.replaceHookForTesting = function() {};
|
||||
// file: src/common/channel.js
|
||||
define("cordova/channel", function(require, exports, module) {
|
||||
|
||||
var utils = require('cordova/utils'),
|
||||
nextGuid = 1;
|
||||
var utils = require('cordova/utils');
|
||||
var nextGuid = 1;
|
||||
|
||||
/**
|
||||
* Custom pub-sub "channel" that can have functions subscribed to it
|
||||
@ -682,16 +676,16 @@ var Channel = function(type, sticky) {
|
||||
// Function that is called when the first listener is subscribed, or when
|
||||
// the last listener is unsubscribed.
|
||||
this.onHasSubscribersChange = null;
|
||||
},
|
||||
channel = {
|
||||
};
|
||||
var channel = {
|
||||
/**
|
||||
* Calls the provided function only after all of the channels specified
|
||||
* have been fired. All channels must be sticky channels.
|
||||
*/
|
||||
join: function (h, c) {
|
||||
var len = c.length,
|
||||
i = len,
|
||||
f = function() {
|
||||
var len = c.length;
|
||||
var i = len;
|
||||
var f = function () {
|
||||
if (!(--i)) h();
|
||||
};
|
||||
for (var j = 0; j < len; j++) {
|
||||
@ -702,13 +696,14 @@ var Channel = function(type, sticky) {
|
||||
}
|
||||
if (!len) h();
|
||||
},
|
||||
/* eslint-disable no-return-assign */
|
||||
create: function (type) {
|
||||
return channel[type] = new Channel(type, false);
|
||||
},
|
||||
createSticky: function (type) {
|
||||
return channel[type] = new Channel(type, true);
|
||||
},
|
||||
|
||||
/* eslint-enable no-return-assign */
|
||||
/**
|
||||
* cordova Channels that must fire before "deviceready" is fired.
|
||||
*/
|
||||
@ -744,10 +739,10 @@ var Channel = function(type, sticky) {
|
||||
};
|
||||
|
||||
function checkSubscriptionArgument (argument) {
|
||||
if (typeof argument !== "function" && typeof argument.handleEvent !== "function") {
|
||||
if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') {
|
||||
throw new Error(
|
||||
"Must provide a function or an EventListener object " +
|
||||
"implementing the handleEvent interface."
|
||||
'Must provide a function or an EventListener object ' +
|
||||
'implementing the handleEvent interface.'
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -763,7 +758,7 @@ Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
|
||||
checkSubscriptionArgument(eventListenerOrFunction);
|
||||
var handleEvent, guid;
|
||||
|
||||
if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
|
||||
if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
|
||||
// Received an EventListener object implementing the handleEvent interface
|
||||
handleEvent = eventListenerOrFunction.handleEvent;
|
||||
eventListener = eventListenerOrFunction;
|
||||
@ -772,13 +767,13 @@ Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
|
||||
handleEvent = eventListenerOrFunction;
|
||||
}
|
||||
|
||||
if (this.state == 2) {
|
||||
if (this.state === 2) {
|
||||
handleEvent.apply(eventListener || this, this.fireArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
guid = eventListenerOrFunction.observer_guid;
|
||||
if (typeof eventListener === "object") {
|
||||
if (typeof eventListener === 'object') {
|
||||
handleEvent = utils.close(eventListener, handleEvent);
|
||||
}
|
||||
|
||||
@ -793,7 +788,7 @@ Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
|
||||
if (!this.handlers[guid]) {
|
||||
this.handlers[guid] = handleEvent;
|
||||
this.numHandlers++;
|
||||
if (this.numHandlers == 1) {
|
||||
if (this.numHandlers === 1) {
|
||||
this.onHasSubscribersChange && this.onHasSubscribersChange();
|
||||
}
|
||||
}
|
||||
@ -806,7 +801,7 @@ Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
|
||||
checkSubscriptionArgument(eventListenerOrFunction);
|
||||
var handleEvent, guid, handler;
|
||||
|
||||
if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
|
||||
if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
|
||||
// Received an EventListener object implementing the handleEvent interface
|
||||
handleEvent = eventListenerOrFunction.handleEvent;
|
||||
} else {
|
||||
@ -829,10 +824,10 @@ Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
|
||||
* Calls all functions subscribed to this channel.
|
||||
*/
|
||||
Channel.prototype.fire = function (e) {
|
||||
var fail = false,
|
||||
fireArgs = Array.prototype.slice.call(arguments);
|
||||
var fail = false; // eslint-disable-line no-unused-vars
|
||||
var fireArgs = Array.prototype.slice.call(arguments);
|
||||
// Apply stickiness.
|
||||
if (this.state == 1) {
|
||||
if (this.state === 1) {
|
||||
this.state = 2;
|
||||
this.fireArgs = fireArgs;
|
||||
}
|
||||
@ -846,7 +841,7 @@ Channel.prototype.fire = function(e) {
|
||||
for (var i = 0; i < toCall.length; ++i) {
|
||||
toCall[i].apply(this, fireArgs);
|
||||
}
|
||||
if (this.state == 2 && this.numHandlers) {
|
||||
if (this.state === 2 && this.numHandlers) {
|
||||
this.numHandlers = 0;
|
||||
this.handlers = {};
|
||||
this.onHasSubscribersChange && this.onHasSubscribersChange();
|
||||
@ -854,7 +849,6 @@ Channel.prototype.fire = function(e) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// defining them here so they are ready super fast!
|
||||
// DOM event that is received when the web page is loaded and parsed.
|
||||
channel.createSticky('onDOMContentLoaded');
|
||||
@ -1172,7 +1166,6 @@ module.exports = androidExec;
|
||||
// file: src/common/exec/proxy.js
|
||||
define("cordova/exec/proxy", function(require, exports, module) {
|
||||
|
||||
|
||||
// internal map of proxy function
|
||||
var CommandProxyMap = {};
|
||||
|
||||
@ -1180,7 +1173,7 @@ module.exports = {
|
||||
|
||||
// example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
|
||||
add: function (id, proxyObj) {
|
||||
console.log("adding proxy for " + id);
|
||||
console.log('adding proxy for ' + id);
|
||||
CommandProxyMap[id] = proxyObj;
|
||||
return proxyObj;
|
||||
},
|
||||
@ -1197,6 +1190,7 @@ module.exports = {
|
||||
return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
// file: src/common/init.js
|
||||
@ -1213,14 +1207,14 @@ var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
|
||||
|
||||
function logUnfiredChannels (arr) {
|
||||
for (var i = 0; i < arr.length; ++i) {
|
||||
if (arr[i].state != 2) {
|
||||
if (arr[i].state !== 2) {
|
||||
console.log('Channel not fired: ' + arr[i].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.setTimeout(function () {
|
||||
if (channel.onDeviceReady.state != 2) {
|
||||
if (channel.onDeviceReady.state !== 2) {
|
||||
console.log('deviceready has not fired after 5 seconds.');
|
||||
logUnfiredChannels(platformInitChannelsArray);
|
||||
logUnfiredChannels(channel.deviceReadyChannelsArray);
|
||||
@ -1237,10 +1231,9 @@ function replaceNavigator(origNavigator) {
|
||||
// Without it, APIs such as getGamepads() break.
|
||||
if (CordovaNavigator.bind) {
|
||||
for (var key in origNavigator) {
|
||||
if (typeof origNavigator[key] == 'function') {
|
||||
if (typeof origNavigator[key] === 'function') {
|
||||
newNavigator[key] = origNavigator[key].bind(origNavigator);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
(function (k) {
|
||||
utils.defineGetterSetter(newNavigator, key, function () {
|
||||
return origNavigator[k];
|
||||
@ -1263,7 +1256,7 @@ if (!window.console) {
|
||||
}
|
||||
if (!window.console.warn) {
|
||||
window.console.warn = function (msg) {
|
||||
this.log("warn: " + msg);
|
||||
this.log('warn: ' + msg);
|
||||
};
|
||||
}
|
||||
|
||||
@ -1274,7 +1267,7 @@ channel.onActivated = cordova.addDocumentEventHandler('activated');
|
||||
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
|
||||
|
||||
// Listen for DOMContentLoaded and notify our channel subscribers.
|
||||
if (document.readyState == 'complete' || document.readyState == 'interactive') {
|
||||
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
||||
channel.onDOMContentLoaded.fire();
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
@ -1324,7 +1317,6 @@ channel.join(function() {
|
||||
|
||||
}, platformInitChannelsArray);
|
||||
|
||||
|
||||
});
|
||||
|
||||
// file: src/common/init_b.js
|
||||
@ -1344,14 +1336,14 @@ cordova.exec = require('cordova/exec');
|
||||
|
||||
function logUnfiredChannels (arr) {
|
||||
for (var i = 0; i < arr.length; ++i) {
|
||||
if (arr[i].state != 2) {
|
||||
if (arr[i].state !== 2) {
|
||||
console.log('Channel not fired: ' + arr[i].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.setTimeout(function () {
|
||||
if (channel.onDeviceReady.state != 2) {
|
||||
if (channel.onDeviceReady.state !== 2) {
|
||||
console.log('deviceready has not fired after 5 seconds.');
|
||||
logUnfiredChannels(platformInitChannelsArray);
|
||||
logUnfiredChannels(channel.deviceReadyChannelsArray);
|
||||
@ -1368,10 +1360,9 @@ function replaceNavigator(origNavigator) {
|
||||
// Without it, APIs such as getGamepads() break.
|
||||
if (CordovaNavigator.bind) {
|
||||
for (var key in origNavigator) {
|
||||
if (typeof origNavigator[key] == 'function') {
|
||||
if (typeof origNavigator[key] === 'function') {
|
||||
newNavigator[key] = origNavigator[key].bind(origNavigator);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
(function (k) {
|
||||
utils.defineGetterSetter(newNavigator, key, function () {
|
||||
return origNavigator[k];
|
||||
@ -1393,7 +1384,7 @@ if (!window.console) {
|
||||
}
|
||||
if (!window.console.warn) {
|
||||
window.console.warn = function (msg) {
|
||||
this.log("warn: " + msg);
|
||||
this.log('warn: ' + msg);
|
||||
};
|
||||
}
|
||||
|
||||
@ -1404,7 +1395,7 @@ channel.onActivated = cordova.addDocumentEventHandler('activated');
|
||||
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
|
||||
|
||||
// Listen for DOMContentLoaded and notify our channel subscribers.
|
||||
if (document.readyState == 'complete' || document.readyState == 'interactive') {
|
||||
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
||||
channel.onDOMContentLoaded.fire();
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
@ -1455,10 +1446,10 @@ channel.join(function() {
|
||||
// file: src/common/modulemapper.js
|
||||
define("cordova/modulemapper", function(require, exports, module) {
|
||||
|
||||
var builder = require('cordova/builder'),
|
||||
moduleMap = define.moduleMap,
|
||||
symbolList,
|
||||
deprecationMap;
|
||||
var builder = require('cordova/builder');
|
||||
var moduleMap = define.moduleMap; // eslint-disable-line no-undef
|
||||
var symbolList;
|
||||
var deprecationMap;
|
||||
|
||||
exports.reset = function () {
|
||||
symbolList = [];
|
||||
@ -1498,7 +1489,7 @@ function prepareNamespace(symbolPath, context) {
|
||||
}
|
||||
var parts = symbolPath.split('.');
|
||||
var cur = context;
|
||||
for (var i = 0, part; part = parts[i]; ++i) {
|
||||
for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
|
||||
cur = cur[part] = cur[part] || {};
|
||||
}
|
||||
return cur;
|
||||
@ -1512,7 +1503,7 @@ exports.mapModules = function(context) {
|
||||
var moduleName = symbolList[i + 1];
|
||||
var module = require(moduleName);
|
||||
// <runs/>
|
||||
if (strategy == 'r') {
|
||||
if (strategy === 'r') {
|
||||
continue;
|
||||
}
|
||||
var symbolPath = symbolList[i + 2];
|
||||
@ -1524,9 +1515,9 @@ exports.mapModules = function(context) {
|
||||
var parentObj = prepareNamespace(namespace, context);
|
||||
var target = parentObj[lastName];
|
||||
|
||||
if (strategy == 'm' && target) {
|
||||
if (strategy === 'm' && target) {
|
||||
builder.recursiveMerge(target, module);
|
||||
} else if ((strategy == 'd' && !target) || (strategy != 'd')) {
|
||||
} else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
|
||||
if (!(symbolPath in origSymbols)) {
|
||||
origSymbols[symbolPath] = target;
|
||||
}
|
||||
@ -1550,15 +1541,14 @@ exports.getOriginalSymbol = function(context, symbolPath) {
|
||||
|
||||
exports.reset();
|
||||
|
||||
|
||||
});
|
||||
|
||||
// file: src/common/modulemapper_b.js
|
||||
define("cordova/modulemapper_b", function(require, exports, module) {
|
||||
|
||||
var builder = require('cordova/builder'),
|
||||
symbolList = [],
|
||||
deprecationMap;
|
||||
var builder = require('cordova/builder');
|
||||
var symbolList = [];
|
||||
var deprecationMap;
|
||||
|
||||
exports.reset = function () {
|
||||
symbolList = [];
|
||||
@ -1595,7 +1585,7 @@ function prepareNamespace(symbolPath, context) {
|
||||
}
|
||||
var parts = symbolPath.split('.');
|
||||
var cur = context;
|
||||
for (var i = 0, part; part = parts[i]; ++i) {
|
||||
for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
|
||||
cur = cur[part] = cur[part] || {};
|
||||
}
|
||||
return cur;
|
||||
@ -1609,7 +1599,7 @@ exports.mapModules = function(context) {
|
||||
var moduleName = symbolList[i + 1];
|
||||
var module = require(moduleName);
|
||||
// <runs/>
|
||||
if (strategy == 'r') {
|
||||
if (strategy === 'r') {
|
||||
continue;
|
||||
}
|
||||
var symbolPath = symbolList[i + 2];
|
||||
@ -1621,9 +1611,9 @@ exports.mapModules = function(context) {
|
||||
var parentObj = prepareNamespace(namespace, context);
|
||||
var target = parentObj[lastName];
|
||||
|
||||
if (strategy == 'm' && target) {
|
||||
if (strategy === 'm' && target) {
|
||||
builder.recursiveMerge(target, module);
|
||||
} else if ((strategy == 'd' && !target) || (strategy != 'd')) {
|
||||
} else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
|
||||
if (!(symbolPath in origSymbols)) {
|
||||
origSymbols[symbolPath] = target;
|
||||
}
|
||||
@ -1647,7 +1637,6 @@ exports.getOriginalSymbol = function(context, symbolPath) {
|
||||
|
||||
exports.reset();
|
||||
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/jbowser/cordova/cordova-android/cordova-js-src/platform.js
|
||||
@ -1857,12 +1846,11 @@ module.exports = {
|
||||
define("cordova/pluginloader", function(require, exports, module) {
|
||||
|
||||
var modulemapper = require('cordova/modulemapper');
|
||||
var urlutil = require('cordova/urlutil');
|
||||
|
||||
// Helper function to inject a <script> tag.
|
||||
// Exported for testing.
|
||||
exports.injectScript = function (url, onload, onerror) {
|
||||
var script = document.createElement("script");
|
||||
var script = document.createElement('script');
|
||||
// onload fires even when script fails loads with an error.
|
||||
script.onload = onload;
|
||||
// onerror fires for malformed URLs.
|
||||
@ -1873,11 +1861,11 @@ exports.injectScript = function(url, onload, onerror) {
|
||||
|
||||
function injectIfNecessary (id, url, onload, onerror) {
|
||||
onerror = onerror || onload;
|
||||
if (id in define.moduleMap) {
|
||||
if (id in define.moduleMap) { // eslint-disable-line no-undef
|
||||
onload();
|
||||
} else {
|
||||
exports.injectScript(url, function () {
|
||||
if (id in define.moduleMap) {
|
||||
if (id in define.moduleMap) { // eslint-disable-line no-undef
|
||||
onload();
|
||||
} else {
|
||||
onerror();
|
||||
@ -1888,7 +1876,7 @@ function injectIfNecessary(id, url, onload, onerror) {
|
||||
|
||||
function onScriptLoadingComplete (moduleList, finishPluginLoading) {
|
||||
// Loop through all the plugins and then through their clobbers and merges.
|
||||
for (var i = 0, module; module = moduleList[i]; i++) {
|
||||
for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
|
||||
if (module.clobbers && module.clobbers.length) {
|
||||
for (var j = 0; j < module.clobbers.length; j++) {
|
||||
modulemapper.clobbers(module.id, module.clobbers[j]);
|
||||
@ -1939,7 +1927,7 @@ function findCordovaPath() {
|
||||
var term = '/cordova.js';
|
||||
for (var n = scripts.length - 1; n > -1; n--) {
|
||||
var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
|
||||
if (src.indexOf(term) == (src.length - term.length)) {
|
||||
if (src.indexOf(term) === (src.length - term.length)) {
|
||||
path = src.substring(0, src.length - term.length) + '/';
|
||||
break;
|
||||
}
|
||||
@ -1957,12 +1945,11 @@ exports.load = function(callback) {
|
||||
pathPrefix = '';
|
||||
}
|
||||
injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function () {
|
||||
var moduleList = require("cordova/plugin_list");
|
||||
var moduleList = require('cordova/plugin_list');
|
||||
handlePluginsObject(pathPrefix, moduleList, callback);
|
||||
}, callback);
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
|
||||
// file: src/common/pluginloader_b.js
|
||||
@ -1979,7 +1966,7 @@ function handlePluginsObject(moduleList) {
|
||||
}
|
||||
|
||||
// Loop through all the modules and then through their clobbers and merges.
|
||||
for (var i = 0, module; module = moduleList[i]; i++) {
|
||||
for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
|
||||
if (module.clobbers && module.clobbers.length) {
|
||||
for (var j = 0; j < module.clobbers.length; j++) {
|
||||
modulemapper.clobbers(module.id, module.clobbers[j]);
|
||||
@ -2004,19 +1991,17 @@ function handlePluginsObject(moduleList) {
|
||||
// onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
|
||||
// no plugins to load, or they are all done.
|
||||
exports.load = function (callback) {
|
||||
var moduleList = require("cordova/plugin_list");
|
||||
var moduleList = require('cordova/plugin_list');
|
||||
handlePluginsObject(moduleList);
|
||||
|
||||
callback();
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
|
||||
// file: src/common/urlutil.js
|
||||
define("cordova/urlutil", function(require, exports, module) {
|
||||
|
||||
|
||||
/**
|
||||
* For already absolute URLs, returns what is passed in.
|
||||
* For relative URLs, converts them to absolute ones.
|
||||
@ -2027,7 +2012,6 @@ exports.makeAbsolute = function makeAbsolute(url) {
|
||||
return anchorEl.href;
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
|
||||
// file: src/common/utils.js
|
||||
@ -2067,7 +2051,7 @@ utils.arrayIndexOf = function(a, item) {
|
||||
}
|
||||
var len = a.length;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
if (a[i] == item) {
|
||||
if (a[i] === item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -2079,10 +2063,10 @@ utils.arrayIndexOf = function(a, item) {
|
||||
*/
|
||||
utils.arrayRemove = function (a, item) {
|
||||
var index = utils.arrayIndexOf(a, item);
|
||||
if (index != -1) {
|
||||
if (index !== -1) {
|
||||
a.splice(index, 1);
|
||||
}
|
||||
return index != -1;
|
||||
return index !== -1;
|
||||
};
|
||||
|
||||
utils.typeName = function (val) {
|
||||
@ -2093,7 +2077,7 @@ utils.typeName = function(val) {
|
||||
* Returns an indication of whether the argument is an array or not
|
||||
*/
|
||||
utils.isArray = Array.isArray ||
|
||||
function(a) {return utils.typeName(a) == 'Array';};
|
||||
function (a) { return utils.typeName(a) === 'Array'; };
|
||||
|
||||
/**
|
||||
* Returns an indication of whether the argument is a Date or not
|
||||
@ -2106,7 +2090,7 @@ utils.isDate = function(d) {
|
||||
* Does a deep clone of the object.
|
||||
*/
|
||||
utils.clone = function (obj) {
|
||||
if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') {
|
||||
if (!obj || typeof obj === 'function' || utils.isDate(obj) || typeof obj !== 'object') {
|
||||
return obj;
|
||||
}
|
||||
|
||||
@ -2125,7 +2109,7 @@ utils.clone = function(obj) {
|
||||
// https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in
|
||||
// custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception
|
||||
// on cloning.
|
||||
if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined' && typeof obj[i] != 'unknown') {
|
||||
if ((!(i in retVal) || retVal[i] !== obj[i]) && typeof obj[i] !== 'undefined' && typeof obj[i] !== 'unknown') { // eslint-disable-line valid-typeof
|
||||
retVal[i] = utils.clone(obj[i]);
|
||||
}
|
||||
}
|
||||
@ -2144,11 +2128,11 @@ utils.close = function(context, func, params) {
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
function UUIDcreatePart (length) {
|
||||
var uuidpart = "";
|
||||
var uuidpart = '';
|
||||
for (var i = 0; i < length; i++) {
|
||||
var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
|
||||
if (uuidchar.length == 1) {
|
||||
uuidchar = "0" + uuidchar;
|
||||
if (uuidchar.length === 1) {
|
||||
uuidchar = '0' + uuidchar;
|
||||
}
|
||||
uuidpart += uuidchar;
|
||||
}
|
||||
@ -2166,7 +2150,6 @@ utils.createUUID = function() {
|
||||
UUIDcreatePart(6);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Extends a child object from a parent object using classical inheritance
|
||||
* pattern.
|
||||
@ -2195,10 +2178,6 @@ utils.alert = function(msg) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
window.cordova = require('cordova');
|
||||
|
Loading…
Reference in New Issue
Block a user