You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/11/22 10:23:32 UTC
[cordova-ios] 01/02: Update JS snapshot to version 5.1.0 (via coho)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
commit c36b691d9bc434c709d238b97de75ec016409372
Author: Erisu <el...@gmail.com>
AuthorDate: Fri Nov 22 14:02:32 2019 +0900
Update JS snapshot to version 5.1.0 (via coho)
---
CordovaLib/cordova.js | 503 +++++++++++++++++++++++++-------------------------
1 file changed, 248 insertions(+), 255 deletions(-)
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 70a179d..60114a0 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,5 +1,5 @@
// Platform: ios
-// 948e932548412305aa7f24b3a90e386aa5c3d12c
+// 7d4d671c98d4cdafbe157795f6adad723adf9c13
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -8,9 +8,9 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,9 +19,8 @@
under the License.
*/
;(function() {
-var PLATFORM_VERSION_BUILD_LABEL = '5.1.0-dev';
+var PLATFORM_VERSION_BUILD_LABEL = '5.1.0';
// file: src/scripts/require.js
-
var require;
var define;
@@ -51,10 +50,10 @@ var define;
require = function (id) {
if (!modules[id]) {
- throw 'module ' + id + ' not found';
+ throw new Error('module ' + id + ' not found');
} else if (id in inProgressModules) {
var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
- throw 'Cycle in require graph: ' + cycle;
+ throw new Error('Cycle in require graph: ' + cycle);
}
if (modules[id].factory) {
try {
@@ -70,8 +69,8 @@ var define;
};
define = function (id, factory) {
- if (modules[id]) {
- throw 'module ' + id + ' already defined';
+ if (Object.prototype.hasOwnProperty.call(modules, id)) {
+ throw new Error('module ' + id + ' already defined');
}
modules[id] = {
@@ -98,7 +97,7 @@ 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)) { // eslint-disable-line no-undef
+if (window.cordova && !(window.cordova instanceof HTMLElement)) {
throw new Error('cordova already defined');
}
@@ -171,7 +170,6 @@ function createEvent (type, data) {
return event;
}
-/* eslint-disable no-undef */
var cordova = {
define: define,
require: require,
@@ -179,8 +177,6 @@ var cordova = {
platformVersion: PLATFORM_VERSION_BUILD_LABEL,
platformId: platform.id,
- /* eslint-enable no-undef */
-
/**
* Methods to add/remove your own addEventListener hijacking on document + window.
*/
@@ -199,15 +195,25 @@ var cordova = {
removeDocumentEventHandler: function (event) {
delete documentEventHandlers[event];
},
+
/**
* Retrieve original event handlers that were replaced by Cordova
*
* @return object
*/
getOriginalHandlers: function () {
- return { 'document': { 'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener },
- 'window': { 'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener } };
+ return {
+ document: {
+ addEventListener: m_document_addEventListener,
+ removeEventListener: m_document_removeEventListener
+ },
+ window: {
+ addEventListener: m_window_addEventListener,
+ removeEventListener: m_window_removeEventListener
+ }
+ };
},
+
/**
* Method to fire event from native code
* bNoDetach is required for events which cause an exception which needs to be caught in native code
@@ -230,6 +236,7 @@ var cordova = {
document.dispatchEvent(evt);
}
},
+
fireWindowEvent: function (type, data) {
var evt = createEvent(type, data);
if (typeof windowEventHandlers[type] !== 'undefined') {
@@ -303,12 +310,11 @@ var cordova = {
}
} catch (err) {
var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
- console && console.log && console.log(msg);
- console && console.log && err.stack && console.log(err.stack);
- cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
+ cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg, 'error': err });
throw err;
}
},
+
addConstructor: function (func) {
channel.onCordovaReady.subscribe(function () {
try {
@@ -341,9 +347,38 @@ var typeMap = {
};
function extractParamName (callee, argIndex) {
- return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
+ return (/\(\s*([^)]*?)\s*\)/).exec(callee)[1].split(/\s*,\s*/)[argIndex];
}
+/**
+ * Checks the given arguments' types and throws if they are not as expected.
+ *
+ * `spec` is a string where each character stands for the required type of the
+ * argument at the same position. In other words: the character at `spec[i]`
+ * specifies the required type for `args[i]`. The characters in `spec` are the
+ * first letter of the required type's name. The supported types are:
+ *
+ * Array, Date, Number, String, Function, Object
+ *
+ * Lowercase characters specify arguments that must not be `null` or `undefined`
+ * while uppercase characters allow those values to be passed.
+ *
+ * Finally, `*` can be used to allow any type at the corresponding position.
+ *
+ * @example
+ * function foo (arr, opts) {
+ * // require `arr` to be an Array and `opts` an Object, null or undefined
+ * checkArgs('aO', 'my.package.foo', arguments);
+ * // ...
+ * }
+ * @param {String} spec - the type specification for `args` as described above
+ * @param {String} functionName - full name of the callee.
+ * Used in the error message
+ * @param {Array|arguments} args - the arguments to be checked against `spec`
+ * @param {Function} [opt_callee=args.callee] - the recipient of `args`.
+ * Used to extract parameter names for the error message
+ * @throws {TypeError} if args do not satisfy spec
+ */
function checkArgs (spec, functionName, args, opt_callee) {
if (!moduleExports.enableChecks) {
return;
@@ -399,7 +434,7 @@ base64.fromArrayBuffer = function (arrayBuffer) {
};
base64.toArrayBuffer = function (str) {
- var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef
+ var decodedStr = atob(str);
var arrayBuffer = new ArrayBuffer(decodedStr.length);
var array = new Uint8Array(arrayBuffer);
for (var i = 0, len = decodedStr.length; i < len; i++) {
@@ -468,7 +503,6 @@ function each (objects, func, context) {
}
function clobber (obj, key, value) {
- exports.replaceHookForTesting(obj, key);
var needsProperty = false;
try {
obj[key] = value;
@@ -568,7 +602,6 @@ exports.buildIntoAndMerge = function (objects, target) {
};
exports.recursiveMerge = recursiveMerge;
exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
-exports.replaceHookForTesting = function () {};
});
@@ -649,14 +682,14 @@ var channel = {
}
if (!len) h();
},
- /* eslint-disable no-return-assign */
+
create: function (type) {
- return channel[type] = new Channel(type, false);
+ return (channel[type] = new Channel(type, false));
},
createSticky: function (type) {
- return channel[type] = new Channel(type, true);
+ return (channel[type] = new Channel(type, true));
},
- /* eslint-enable no-return-assign */
+
/**
* cordova Channels that must fire before "deviceready" is fired.
*/
@@ -777,7 +810,6 @@ Channel.prototype.unsubscribe = function (eventListenerOrFunction) {
* Calls all functions subscribed to this channel.
*/
Channel.prototype.fire = function (e) {
- var fail = false; // eslint-disable-line no-unused-vars
var fireArgs = Array.prototype.slice.call(arguments);
// Apply stickiness.
if (this.state === 1) {
@@ -834,30 +866,30 @@ module.exports = channel;
});
-// file: /Users/dpogue/Coding/cordova-ios/cordova-js-src/exec.js
+// file: ../cordova-ios/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) {
-/*global require, module, atob, document */
+/* global require, module, atob, document */
/**
* Creates a gap bridge iframe used to notify the native code about queued
* commands.
*/
-var cordova = require('cordova'),
- utils = require('cordova/utils'),
- base64 = require('cordova/base64'),
- execIframe,
- commandQueue = [], // Contains pending JS->Native messages.
- isInContextOfEvalJs = 0,
- failSafeTimerId = 0;
-
-function massageArgsJsToNative(args) {
- if (!args || utils.typeName(args) != 'Array') {
+var cordova = require('cordova');
+var utils = require('cordova/utils');
+var base64 = require('cordova/base64');
+var execIframe;
+var commandQueue = []; // Contains pending JS->Native messages.
+var isInContextOfEvalJs = 0;
+var failSafeTimerId = 0;
+
+function massageArgsJsToNative (args) {
+ if (!args || utils.typeName(args) !== 'Array') {
return args;
}
var ret = [];
- args.forEach(function(arg, i) {
- if (utils.typeName(arg) == 'ArrayBuffer') {
+ args.forEach(function (arg, i) {
+ if (utils.typeName(arg) === 'ArrayBuffer') {
ret.push({
'CDVType': 'ArrayBuffer',
'data': base64.fromArrayBuffer(arg)
@@ -869,16 +901,16 @@ function massageArgsJsToNative(args) {
return ret;
}
-function massageMessageNativeToJs(message) {
- if (message.CDVType == 'ArrayBuffer') {
- var stringToArrayBuffer = function(str) {
+function massageMessageNativeToJs (message) {
+ if (message.CDVType === 'ArrayBuffer') {
+ var stringToArrayBuffer = function (str) {
var ret = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i);
}
return ret.buffer;
};
- var base64ToArrayBuffer = function(b64) {
+ var base64ToArrayBuffer = function (b64) {
return stringToArrayBuffer(atob(b64));
};
message = base64ToArrayBuffer(message.data);
@@ -886,12 +918,12 @@ function massageMessageNativeToJs(message) {
return message;
}
-function convertMessageToArgsNativeToJs(message) {
+function convertMessageToArgsNativeToJs (message) {
var args = [];
if (!message || !message.hasOwnProperty('CDVType')) {
args.push(message);
- } else if (message.CDVType == 'MultiPart') {
- message.messages.forEach(function(e) {
+ } else if (message.CDVType === 'MultiPart') {
+ message.messages.forEach(function (e) {
args.push(massageMessageNativeToJs(e));
});
} else {
@@ -900,7 +932,7 @@ function convertMessageToArgsNativeToJs(message) {
return args;
}
-function iOSExec() {
+function iOSExec () {
var successCallback, failCallback, service, action, actionArgs;
var callbackId = null;
@@ -931,7 +963,7 @@ function iOSExec() {
if (successCallback || failCallback) {
callbackId = service + cordova.callbackId++;
cordova.callbacks[callbackId] =
- {success:successCallback, fail:failCallback};
+ { success: successCallback, fail: failCallback };
}
actionArgs = massageArgsJsToNative(actionArgs);
@@ -947,49 +979,49 @@ function iOSExec() {
// then the queue will be flushed when it returns; no need for a poke.
// Also, if there is already a command in the queue, then we've already
// poked the native side, so there is no reason to do so again.
- if (!isInContextOfEvalJs && commandQueue.length == 1) {
+ if (!isInContextOfEvalJs && commandQueue.length === 1) {
pokeNative();
}
}
// CB-10530
-function proxyChanged() {
+function proxyChanged () {
var cexec = cordovaExec();
-
+
return (execProxy !== cexec && // proxy objects are different
- iOSExec !== cexec // proxy object is not the current iOSExec
- );
+ iOSExec !== cexec // proxy object is not the current iOSExec
+ );
}
// CB-10106
-function handleBridgeChange() {
+function handleBridgeChange () {
if (proxyChanged()) {
var commandString = commandQueue.shift();
- while(commandString) {
+ while (commandString) {
var command = JSON.parse(commandString);
var callbackId = command[0];
var service = command[1];
var action = command[2];
var actionArgs = command[3];
var callbacks = cordova.callbacks[callbackId] || {};
-
+
execProxy(callbacks.success, callbacks.fail, service, action, actionArgs);
-
+
commandString = commandQueue.shift();
- };
+ }
return true;
}
-
+
return false;
}
-function pokeNative() {
+function pokeNative () {
// CB-5488 - Don't attempt to create iframe before document.body is available.
if (!document.body) {
setTimeout(pokeNative);
return;
}
-
+
// Check if they've removed it from the DOM, and put it back if so.
if (execIframe && execIframe.contentWindow) {
execIframe.contentWindow.location = 'gap://ready';
@@ -1006,17 +1038,17 @@ function pokeNative() {
// created, but since unload events fire only once, it doesn't work in the normal
// case of iframe reuse (where unload will have already fired due to the attempted
// navigation of the page).
- failSafeTimerId = setTimeout(function() {
+ failSafeTimerId = setTimeout(function () {
if (commandQueue.length) {
// CB-10106 - flush the queue on bridge change
if (!handleBridgeChange()) {
pokeNative();
- }
+ }
}
}, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire).
}
-iOSExec.nativeFetchMessages = function() {
+iOSExec.nativeFetchMessages = function () {
// Stop listing for window detatch once native side confirms poke.
if (failSafeTimerId) {
clearTimeout(failSafeTimerId);
@@ -1031,18 +1063,18 @@ iOSExec.nativeFetchMessages = function() {
return json;
};
-iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) {
- return iOSExec.nativeEvalAndFetch(function() {
+iOSExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) {
+ return iOSExec.nativeEvalAndFetch(function () {
var success = status === 0 || status === 1;
var args = convertMessageToArgsNativeToJs(message);
- function nc2() {
+ function nc2 () {
cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
}
setTimeout(nc2, 0);
});
};
-iOSExec.nativeEvalAndFetch = function(func) {
+iOSExec.nativeEvalAndFetch = function (func) {
// This shouldn't be nested, but better to be safe.
isInContextOfEvalJs++;
try {
@@ -1055,25 +1087,25 @@ iOSExec.nativeEvalAndFetch = function(func) {
// Proxy the exec for bridge changes. See CB-10106
-function cordovaExec() {
+function cordovaExec () {
var cexec = require('cordova/exec');
var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function');
- return (cexec_valid && execProxy !== cexec)? cexec : iOSExec;
+ return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec;
}
-function execProxy() {
+function execProxy () {
cordovaExec().apply(null, arguments);
-};
+}
-execProxy.nativeFetchMessages = function() {
+execProxy.nativeFetchMessages = function () {
return cordovaExec().nativeFetchMessages.apply(null, arguments);
};
-execProxy.nativeEvalAndFetch = function() {
+execProxy.nativeEvalAndFetch = function () {
return cordovaExec().nativeEvalAndFetch.apply(null, arguments);
};
-execProxy.nativeCallback = function() {
+execProxy.nativeCallback = function () {
return cordovaExec().nativeCallback.apply(null, arguments);
};
@@ -1119,7 +1151,6 @@ var cordova = require('cordova');
var modulemapper = require('cordova/modulemapper');
var platform = require('cordova/platform');
var pluginloader = require('cordova/pluginloader');
-var utils = require('cordova/utils');
var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
@@ -1139,34 +1170,6 @@ window.setTimeout(function () {
}
}, 5000);
-// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
-// We replace it so that properties that can't be clobbered can instead be overridden.
-function replaceNavigator (origNavigator) {
- var CordovaNavigator = function () {};
- CordovaNavigator.prototype = origNavigator;
- var newNavigator = new CordovaNavigator();
- // This work-around really only applies to new APIs that are newer than Function.bind.
- // Without it, APIs such as getGamepads() break.
- if (CordovaNavigator.bind) {
- for (var key in origNavigator) {
- if (typeof origNavigator[key] === 'function') {
- newNavigator[key] = origNavigator[key].bind(origNavigator);
- } else {
- (function (k) {
- utils.defineGetterSetter(newNavigator, key, function () {
- return origNavigator[k];
- });
- })(key);
- }
- }
- }
- return newNavigator;
-}
-
-if (window.navigator) {
- window.navigator = replaceNavigator(window.navigator);
-}
-
if (!window.console) {
window.console = {
log: function () {}
@@ -1232,7 +1235,6 @@ channel.join(function () {
channel.join(function () {
require('cordova').fireDocumentEvent('deviceready');
}, channel.deviceReadyChannelsArray);
-
}, platformInitChannelsArray);
});
@@ -1241,7 +1243,7 @@ channel.join(function () {
define("cordova/modulemapper", function(require, exports, module) {
var builder = require('cordova/builder');
-var moduleMap = define.moduleMap; // eslint-disable-line no-undef
+var moduleMap = define.moduleMap;
var symbolList;
var deprecationMap;
@@ -1281,12 +1283,9 @@ function prepareNamespace (symbolPath, context) {
if (!symbolPath) {
return context;
}
- var parts = symbolPath.split('.');
- var cur = context;
- for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
- cur = cur[part] = cur[part] || {};
- }
- return cur;
+ return symbolPath.split('.').reduce(function (cur, part) {
+ return (cur[part] = cur[part] || {});
+ }, context);
}
exports.mapModules = function (context) {
@@ -1337,7 +1336,7 @@ exports.reset();
});
-// file: /Users/dpogue/Coding/cordova-ios/cordova-js-src/platform.js
+// file: ../cordova-ios/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) {
module.exports = {
@@ -1353,181 +1352,181 @@ module.exports = {
});
-// file: /Users/dpogue/Coding/cordova-ios/cordova-js-src/plugin/ios/console.js
+// file: ../cordova-ios/cordova-js-src/plugin/ios/console.js
define("cordova/plugin/ios/console", function(require, exports, module) {
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
var logger = require('cordova/plugin/ios/logger');
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// object that we're exporting
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
var console = module.exports;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// copy of the original console object
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
var WinConsole = window.console;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// whether to use the logger
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
var UseLogger = false;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// Timers
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
var Timers = {};
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// used for unimplemented methods
-//------------------------------------------------------------------------------
-function noop() {}
+// ------------------------------------------------------------------------------
+function noop () {}
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// used for unimplemented methods
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.useLogger = function (value) {
if (arguments.length) UseLogger = !!value;
if (UseLogger) {
if (logger.useConsole()) {
- throw new Error("console and logger are too intertwingly");
+ throw new Error('console and logger are too intertwingly');
}
}
return UseLogger;
};
-//------------------------------------------------------------------------------
-console.log = function() {
+// ------------------------------------------------------------------------------
+console.log = function () {
if (logger.useConsole()) return;
logger.log.apply(logger, [].slice.call(arguments));
};
-//------------------------------------------------------------------------------
-console.error = function() {
+// ------------------------------------------------------------------------------
+console.error = function () {
if (logger.useConsole()) return;
logger.error.apply(logger, [].slice.call(arguments));
};
-//------------------------------------------------------------------------------
-console.warn = function() {
+// ------------------------------------------------------------------------------
+console.warn = function () {
if (logger.useConsole()) return;
logger.warn.apply(logger, [].slice.call(arguments));
};
-//------------------------------------------------------------------------------
-console.info = function() {
+// ------------------------------------------------------------------------------
+console.info = function () {
if (logger.useConsole()) return;
logger.info.apply(logger, [].slice.call(arguments));
};
-//------------------------------------------------------------------------------
-console.debug = function() {
+// ------------------------------------------------------------------------------
+console.debug = function () {
if (logger.useConsole()) return;
logger.debug.apply(logger, [].slice.call(arguments));
};
-//------------------------------------------------------------------------------
-console.assert = function(expression) {
+// ------------------------------------------------------------------------------
+console.assert = function (expression) {
if (expression) return;
var message = logger.format.apply(logger.format, [].slice.call(arguments, 1));
- console.log("ASSERT: " + message);
+ console.log('ASSERT: ' + message);
};
-//------------------------------------------------------------------------------
-console.clear = function() {};
+// ------------------------------------------------------------------------------
+console.clear = function () {};
-//------------------------------------------------------------------------------
-console.dir = function(object) {
- console.log("%o", object);
+// ------------------------------------------------------------------------------
+console.dir = function (object) {
+ console.log('%o', object);
};
-//------------------------------------------------------------------------------
-console.dirxml = function(node) {
+// ------------------------------------------------------------------------------
+console.dirxml = function (node) {
console.log(node.innerHTML);
};
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.trace = noop;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.group = console.log;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.groupCollapsed = console.log;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.groupEnd = noop;
-//------------------------------------------------------------------------------
-console.time = function(name) {
+// ------------------------------------------------------------------------------
+console.time = function (name) {
Timers[name] = new Date().valueOf();
};
-//------------------------------------------------------------------------------
-console.timeEnd = function(name) {
+// ------------------------------------------------------------------------------
+console.timeEnd = function (name) {
var timeStart = Timers[name];
if (!timeStart) {
- console.warn("unknown timer: " + name);
+ console.warn('unknown timer: ' + name);
return;
}
var timeElapsed = new Date().valueOf() - timeStart;
- console.log(name + ": " + timeElapsed + "ms");
+ console.log(name + ': ' + timeElapsed + 'ms');
};
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.timeStamp = noop;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.profile = noop;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.profileEnd = noop;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.count = noop;
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
console.exception = console.log;
-//------------------------------------------------------------------------------
-console.table = function(data, columns) {
- console.log("%o", data);
+// ------------------------------------------------------------------------------
+console.table = function (data, columns) {
+ console.log('%o', data);
};
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// return a new function that calls both functions passed as args
-//------------------------------------------------------------------------------
-function wrappedOrigCall(orgFunc, newFunc) {
- return function() {
+// ------------------------------------------------------------------------------
+function wrappedOrigCall (orgFunc, newFunc) {
+ return function () {
var args = [].slice.call(arguments);
try { orgFunc.apply(WinConsole, args); } catch (e) {}
- try { newFunc.apply(console, args); } catch (e) {}
+ try { newFunc.apply(console, args); } catch (e) {}
};
}
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// For every function that exists in the original console object, that
// also exists in the new console object, wrap the new console method
// with one that calls both
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
for (var key in console) {
- if (typeof WinConsole[key] == "function") {
+ if (typeof WinConsole[key] === 'function') {
console[key] = wrappedOrigCall(WinConsole[key], console[key]);
}
}
});
-// file: /Users/dpogue/Coding/cordova-ios/cordova-js-src/plugin/ios/logger.js
+// file: ../cordova-ios/cordova-js-src/plugin/ios/logger.js
define("cordova/plugin/ios/logger", function(require, exports, module) {
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// The logger module exports the following properties/functions:
//
// LOG - constant for the level LOG
@@ -1546,16 +1545,16 @@ define("cordova/plugin/ios/logger", function(require, exports, module) {
// debug(message,...) - logs a message at level DEBUG
// logLevel(level,message,...) - logs a message specified level
//
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
var logger = exports;
-var exec = require('cordova/exec');
+var exec = require('cordova/exec');
-var UseConsole = false;
-var UseLogger = true;
-var Queued = [];
-var DeviceReady = false;
+var UseConsole = false;
+var UseLogger = true;
+var Queued = [];
+var DeviceReady = false;
var CurrentLevel;
var originalConsole = console;
@@ -1565,11 +1564,11 @@ var originalConsole = console;
*/
var Levels = [
- "LOG",
- "ERROR",
- "WARN",
- "INFO",
- "DEBUG"
+ 'LOG',
+ 'ERROR',
+ 'WARN',
+ 'INFO',
+ 'DEBUG'
];
/*
@@ -1578,10 +1577,10 @@ var Levels = [
*/
var LevelsMap = {};
-for (var i=0; i<Levels.length; i++) {
+for (var i = 0; i < Levels.length; i++) {
var level = Levels[i];
LevelsMap[level] = i;
- logger[level] = level;
+ logger[level] = level;
}
CurrentLevel = LevelsMap.WARN;
@@ -1608,7 +1607,7 @@ CurrentLevel = LevelsMap.WARN;
logger.level = function (value) {
if (arguments.length) {
if (LevelsMap[value] === null) {
- throw new Error("invalid logging level: " + value);
+ throw new Error('invalid logging level: ' + value);
}
CurrentLevel = LevelsMap[value];
}
@@ -1626,17 +1625,17 @@ logger.useConsole = function (value) {
if (arguments.length) UseConsole = !!value;
if (UseConsole) {
- if (typeof console == "undefined") {
- throw new Error("global console object is not defined");
+ if (typeof console === 'undefined') {
+ throw new Error('global console object is not defined');
}
- if (typeof console.log != "function") {
- throw new Error("global console object does not have a log function");
+ if (typeof console.log !== 'function') {
+ throw new Error('global console object does not have a log function');
}
- if (typeof console.useLogger == "function") {
+ if (typeof console.useLogger === 'function') {
if (console.useLogger()) {
- throw new Error("console and logger are too intertwingly");
+ throw new Error('console and logger are too intertwingly');
}
}
}
@@ -1662,7 +1661,7 @@ logger.useLogger = function (value) {
* Parameters passed after message are used applied to
* the message with utils.format()
*/
-logger.log = function(message) { logWithArgs("LOG", arguments); };
+logger.log = function (message) { logWithArgs('LOG', arguments); };
/**
* Logs a message at the ERROR level.
@@ -1670,7 +1669,7 @@ logger.log = function(message) { logWithArgs("LOG", arguments); };
* Parameters passed after message are used applied to
* the message with utils.format()
*/
-logger.error = function(message) { logWithArgs("ERROR", arguments); };
+logger.error = function (message) { logWithArgs('ERROR', arguments); };
/**
* Logs a message at the WARN level.
@@ -1678,7 +1677,7 @@ logger.error = function(message) { logWithArgs("ERROR", arguments); };
* Parameters passed after message are used applied to
* the message with utils.format()
*/
-logger.warn = function(message) { logWithArgs("WARN", arguments); };
+logger.warn = function (message) { logWithArgs('WARN', arguments); };
/**
* Logs a message at the INFO level.
@@ -1686,7 +1685,7 @@ logger.warn = function(message) { logWithArgs("WARN", arguments); };
* Parameters passed after message are used applied to
* the message with utils.format()
*/
-logger.info = function(message) { logWithArgs("INFO", arguments); };
+logger.info = function (message) { logWithArgs('INFO', arguments); };
/**
* Logs a message at the DEBUG level.
@@ -1694,17 +1693,17 @@ logger.info = function(message) { logWithArgs("INFO", arguments); };
* Parameters passed after message are used applied to
* the message with utils.format()
*/
-logger.debug = function(message) { logWithArgs("DEBUG", arguments); };
+logger.debug = function (message) { logWithArgs('DEBUG', arguments); };
// log at the specified level with args
-function logWithArgs(level, args) {
+function logWithArgs (level, args) {
args = [level].concat([].slice.call(args));
logger.logLevel.apply(logger, args);
}
// return the correct formatString for an object
-function formatStringForMessage(message) {
- return (typeof message === "string") ? "" : "%o";
+function formatStringForMessage (message) {
+ return (typeof message === 'string') ? '' : '%o';
}
/**
@@ -1713,18 +1712,18 @@ function formatStringForMessage(message) {
* Parameters passed after message are used applied to
* the message with utils.format()
*/
-logger.logLevel = function(level /* , ... */) {
+logger.logLevel = function (level /* , ... */) {
// format the message with the parameters
var formatArgs = [].slice.call(arguments, 1);
var fmtString = formatStringForMessage(formatArgs[0]);
- if (fmtString.length > 0){
+ if (fmtString.length > 0) {
formatArgs.unshift(fmtString); // add formatString
}
- var message = logger.format.apply(logger.format, formatArgs);
+ var message = logger.format.apply(logger.format, formatArgs);
if (LevelsMap[level] === null) {
- throw new Error("invalid logging level: " + level);
+ throw new Error('invalid logging level: ' + level);
}
if (LevelsMap[level] > CurrentLevel) return;
@@ -1737,28 +1736,27 @@ logger.logLevel = function(level /* , ... */) {
// Log using the native logger if that is enabled
if (UseLogger) {
- exec(null, null, "Console", "logLevel", [level, message]);
+ exec(null, null, 'Console', 'logLevel', [level, message]);
}
// Log using the console if that is enabled
if (UseConsole) {
// make sure console is not using logger
if (console.useLogger()) {
- throw new Error("console and logger are too intertwingly");
+ throw new Error('console and logger are too intertwingly');
}
// log to the console
switch (level) {
- case logger.LOG: originalConsole.log(message); break;
- case logger.ERROR: originalConsole.log("ERROR: " + message); break;
- case logger.WARN: originalConsole.log("WARN: " + message); break;
- case logger.INFO: originalConsole.log("INFO: " + message); break;
- case logger.DEBUG: originalConsole.log("DEBUG: " + message); break;
+ case logger.LOG: originalConsole.log(message); break;
+ case logger.ERROR: originalConsole.log('ERROR: ' + message); break;
+ case logger.WARN: originalConsole.log('WARN: ' + message); break;
+ case logger.INFO: originalConsole.log('INFO: ' + message); break;
+ case logger.DEBUG: originalConsole.log('DEBUG: ' + message); break;
}
}
};
-
/**
* Formats a string and arguments following it ala console.log()
*
@@ -1767,12 +1765,11 @@ logger.logLevel = function(level /* , ... */) {
* for rationale, see FireBug's Console API:
* http://getfirebug.com/wiki/index.php/Console_API
*/
-logger.format = function(formatString, args) {
- return __format(arguments[0], [].slice.call(arguments,1)).join(' ');
+logger.format = function (formatString, args) {
+ return __format(arguments[0], [].slice.call(arguments, 1)).join(' ');
};
-
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
/**
* Formats a string and arguments following it ala vsprintf()
*
@@ -1787,26 +1784,25 @@ logger.format = function(formatString, args) {
* Returns an array containing the formatted string and any remaining
* arguments.
*/
-function __format(formatString, args) {
- if (formatString === null || formatString === undefined) return [""];
- if (arguments.length == 1) return [formatString.toString()];
+function __format (formatString, args) {
+ if (formatString === null || formatString === undefined) return [''];
+ if (arguments.length === 1) return [formatString.toString()];
- if (typeof formatString != "string")
- formatString = formatString.toString();
+ if (typeof formatString !== 'string') { formatString = formatString.toString(); }
var pattern = /(.*?)%(.)(.*)/;
- var rest = formatString;
- var result = [];
+ var rest = formatString;
+ var result = [];
while (args.length) {
var match = pattern.exec(rest);
if (!match) break;
- var arg = args.shift();
+ var arg = args.shift();
rest = match[3];
result.push(match[1]);
- if (match[2] == '%') {
+ if (match[2] === '%') {
result.push('%');
args.unshift(arg);
continue;
@@ -1822,17 +1818,16 @@ function __format(formatString, args) {
return remainingArgs;
}
-function __formatted(object, formatChar) {
+function __formatted (object, formatChar) {
try {
- switch(formatChar) {
- case 'j':
- case 'o': return JSON.stringify(object);
- case 'c': return '';
+ switch (formatChar) {
+ case 'j':
+ case 'o': return JSON.stringify(object);
+ case 'c': return '';
}
- }
- catch (e) {
- return "error JSON.stringify()ing argument: " + e;
+ } catch (e) {
+ return 'error JSON.stringify()ing argument: ' + e;
}
if ((object === null) || (object === undefined)) {
@@ -1842,15 +1837,14 @@ function __formatted(object, formatChar) {
return object.toString();
}
-
-//------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------
// when deviceready fires, log queued messages
-logger.__onDeviceReady = function() {
+logger.__onDeviceReady = function () {
if (DeviceReady) return;
DeviceReady = true;
- for (var i=0; i<Queued.length; i++) {
+ for (var i = 0; i < Queued.length; i++) {
var messageArgs = Queued[i];
logger.logLevel(messageArgs[0], messageArgs[1]);
}
@@ -1859,7 +1853,7 @@ logger.__onDeviceReady = function() {
};
// add a deviceready event to log queued messages
-document.addEventListener("deviceready", logger.__onDeviceReady, false);
+document.addEventListener('deviceready', logger.__onDeviceReady, false);
});
@@ -1882,11 +1876,11 @@ exports.injectScript = function (url, onload, onerror) {
function injectIfNecessary (id, url, onload, onerror) {
onerror = onerror || onload;
- if (id in define.moduleMap) { // eslint-disable-line no-undef
+ if (id in define.moduleMap) {
onload();
} else {
exports.injectScript(url, function () {
- if (id in define.moduleMap) { // eslint-disable-line no-undef
+ if (id in define.moduleMap) {
onload();
} else {
onerror();
@@ -1897,7 +1891,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++) { // eslint-disable-line no-cond-assign
+ for (var i = 0, module; (module = moduleList[i]); i++) {
if (module.clobbers && module.clobbers.length) {
for (var j = 0; j < module.clobbers.length; j++) {
modulemapper.clobbers(module.id, module.clobbers[j]);
@@ -2080,10 +2074,11 @@ utils.clone = function (obj) {
retVal = {};
for (i in 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') { // eslint-disable-line valid-typeof
+ // 'unknown' type may be returned in custom protocol activation case on
+ // Windows Phone 8.1 causing "No such interface supported" exception on
+ // cloning (https://issues.apache.org/jira/browse/CB-11522)
+ // eslint-disable-next-line valid-typeof
+ if ((!(i in retVal) || retVal[i] !== obj[i]) && typeof obj[i] !== 'undefined' && typeof obj[i] !== 'unknown') {
retVal[i] = utils.clone(obj[i]);
}
}
@@ -2133,7 +2128,6 @@ utils.extend = (function () {
var F = function () {};
// extend Child from Parent
return function (Child, Parent) {
-
F.prototype = Parent.prototype;
Child.prototype = new F();
Child.__super__ = Parent.prototype;
@@ -2156,7 +2150,6 @@ utils.alert = function (msg) {
window.cordova = require('cordova');
// file: src/scripts/bootstrap.js
-
require('cordova/init');
-})();
\ No newline at end of file
+})();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org