@capacitor/core
Advanced tools
Comparing version 6.1.3-nightly-20241011T150501.0 to 6.2.0
196
cordova.js
@@ -44,3 +44,6 @@ // Platform: Capacitor | ||
if (id.charAt(0) === '.') { | ||
resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2); | ||
resultantId = | ||
module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + | ||
SEPARATOR + | ||
id.slice(2); | ||
} | ||
@@ -59,3 +62,4 @@ return require(resultantId); | ||
} else if (id in inProgressModules) { | ||
var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id; | ||
var cycle = | ||
requireStack.slice(inProgressModules[id]).join('->') + '->' + id; | ||
throw 'Cycle in require graph: ' + cycle; | ||
@@ -260,3 +264,9 @@ } | ||
callbackSuccess: function (callbackId, args) { | ||
cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback); | ||
cordova.callbackFromNative( | ||
callbackId, | ||
true, | ||
args.status, | ||
[args.message], | ||
args.keepCallback, | ||
); | ||
}, | ||
@@ -270,3 +280,9 @@ | ||
// Derive success from status. | ||
cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback); | ||
cordova.callbackFromNative( | ||
callbackId, | ||
false, | ||
args.status, | ||
[args.message], | ||
args.keepCallback, | ||
); | ||
}, | ||
@@ -277,3 +293,9 @@ | ||
*/ | ||
callbackFromNative: function (callbackId, isSuccess, status, args, keepCallback) { | ||
callbackFromNative: function ( | ||
callbackId, | ||
isSuccess, | ||
status, | ||
args, | ||
keepCallback, | ||
) { | ||
try { | ||
@@ -300,3 +322,9 @@ var callback = cordova.callbacks[callbackId]; | ||
} catch (err) { | ||
var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err; | ||
var msg = | ||
'Error in ' + | ||
(isSuccess ? 'Success' : 'Error') + | ||
' callbackId: ' + | ||
callbackId + | ||
' : ' + | ||
err; | ||
console && console.log && console.log(msg); | ||
@@ -399,3 +427,6 @@ cordova.fireWindowEvent('cordovacallbackerror', { message: msg }); | ||
base64.toArrayBuffer = function (str) { | ||
var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef | ||
var decodedStr = | ||
typeof atob !== 'undefined' | ||
? atob(str) | ||
: Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef | ||
var arrayBuffer = new ArrayBuffer(decodedStr.length); | ||
@@ -416,3 +447,4 @@ var array = new Uint8Array(arrayBuffer); | ||
var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | ||
var b64_6bit = | ||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | ||
var b64_12bit; | ||
@@ -506,3 +538,8 @@ | ||
if (typeof parent[key] === 'undefined') { | ||
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); | ||
assignOrWrapInDeprecateGetter( | ||
parent, | ||
key, | ||
result, | ||
obj.deprecated, | ||
); | ||
} else if (typeof obj.path !== 'undefined') { | ||
@@ -513,3 +550,8 @@ // If merging, merge properties onto parent, otherwise, clobber. | ||
} else { | ||
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); | ||
assignOrWrapInDeprecateGetter( | ||
parent, | ||
key, | ||
result, | ||
obj.deprecated, | ||
); | ||
} | ||
@@ -521,3 +563,8 @@ } | ||
if (typeof parent[key] === 'undefined') { | ||
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); | ||
assignOrWrapInDeprecateGetter( | ||
parent, | ||
key, | ||
result, | ||
obj.deprecated, | ||
); | ||
} else { | ||
@@ -533,3 +580,9 @@ // Set result to what already exists, so we can build children into it if they exist. | ||
} catch (e) { | ||
utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"'); | ||
utils.alert( | ||
'Exception building Cordova JS globals: ' + | ||
e + | ||
' for key "' + | ||
key + | ||
'"', | ||
); | ||
} | ||
@@ -553,3 +606,6 @@ }); | ||
} else { | ||
if (typeof src[prop] === 'object' && typeof target[prop] === 'object') { | ||
if ( | ||
typeof src[prop] === 'object' && | ||
typeof target[prop] === 'object' | ||
) { | ||
recursiveMerge(target[prop], src[prop]); | ||
@@ -697,5 +753,9 @@ } else { | ||
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.', | ||
); | ||
@@ -712,7 +772,13 @@ } | ||
*/ | ||
Channel.prototype.subscribe = function (eventListenerOrFunction, eventListener) { | ||
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 | ||
@@ -760,3 +826,6 @@ handleEvent = eventListenerOrFunction.handleEvent; | ||
if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') { | ||
if ( | ||
eventListenerOrFunction && | ||
typeof eventListenerOrFunction === 'object' | ||
) { | ||
// Received an EventListener object implementing the handleEvent interface | ||
@@ -963,3 +1032,7 @@ handleEvent = eventListenerOrFunction.handleEvent; | ||
window.androidBridge.postMessage(JSON.stringify(command)); | ||
} else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.bridge) { | ||
} else if ( | ||
window.webkit && | ||
window.webkit.messageHandlers && | ||
window.webkit.messageHandlers.bridge | ||
) { | ||
window.webkit.messageHandlers.bridge.postMessage(command); | ||
@@ -990,3 +1063,9 @@ } | ||
execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); | ||
execProxy( | ||
callbacks.success, | ||
callbacks.fail, | ||
service, | ||
action, | ||
actionArgs, | ||
); | ||
@@ -1049,7 +1128,19 @@ commandString = commandQueue.shift(); | ||
capacitorExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) { | ||
capacitorExec.nativeCallback = function ( | ||
callbackId, | ||
status, | ||
message, | ||
keepCallback, | ||
debug, | ||
) { | ||
var success = status === 0 || status === 1; | ||
var args = convertMessageToArgsNativeToJs(message); | ||
Promise.resolve().then(function () { | ||
cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line | ||
cordova.callbackFromNative( | ||
callbackId, | ||
success, | ||
status, | ||
args, | ||
keepCallback, | ||
); // eslint-disable-line | ||
}); | ||
@@ -1117,3 +1208,5 @@ }; | ||
get: function (service, action) { | ||
return CommandProxyMap[service] ? CommandProxyMap[service][action] : null; | ||
return CommandProxyMap[service] | ||
? CommandProxyMap[service][action] | ||
: null; | ||
}, | ||
@@ -1132,3 +1225,6 @@ }; | ||
var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady]; | ||
var platformInitChannelsArray = [ | ||
channel.onNativeReady, | ||
channel.onPluginsReady, | ||
]; | ||
@@ -1183,6 +1279,10 @@ function logUnfiredChannels(arr) { | ||
channel.onActivated = cordova.addDocumentEventHandler('activated'); | ||
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); | ||
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(); | ||
@@ -1253,3 +1353,8 @@ } else { | ||
function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) { | ||
function addEntry( | ||
strategy, | ||
moduleName, | ||
symbolPath, | ||
opt_deprecationMessage, | ||
) { | ||
if (!(moduleName in moduleMap)) { | ||
@@ -1265,3 +1370,7 @@ throw new Error('Module ' + moduleName + ' does not exist.'); | ||
// Note: Android 2.3 does have Function.bind(). | ||
exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) { | ||
exports.clobbers = function ( | ||
moduleName, | ||
symbolPath, | ||
opt_deprecationMessage, | ||
) { | ||
addEntry('c', moduleName, symbolPath, opt_deprecationMessage); | ||
@@ -1274,3 +1383,7 @@ }; | ||
exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) { | ||
exports.defaults = function ( | ||
moduleName, | ||
symbolPath, | ||
opt_deprecationMessage, | ||
) { | ||
addEntry('d', moduleName, symbolPath, opt_deprecationMessage); | ||
@@ -1314,3 +1427,6 @@ }; | ||
symbolPath in deprecationMap | ||
? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg | ||
? 'Access made to deprecated symbol: ' + | ||
symbolPath + | ||
'. ' + | ||
deprecationMsg | ||
: null; | ||
@@ -1326,3 +1442,8 @@ var parentObj = prepareNamespace(namespace, context); | ||
} | ||
builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg); | ||
builder.assignOrWrapInDeprecateGetter( | ||
parentObj, | ||
lastName, | ||
module, | ||
deprecationMsg, | ||
); | ||
} | ||
@@ -1487,3 +1608,8 @@ } | ||
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; | ||
@@ -1507,3 +1633,7 @@ } | ||
// 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 | ||
@@ -1510,0 +1640,0 @@ retVal[i] = utils.clone(obj[i]); |
@@ -118,3 +118,5 @@ /*! Capacitor: https://capacitorjs.com/ - MIT License */ | ||
const defaultGetPlatform = () => { | ||
return capCustomPlatform !== null ? capCustomPlatform.name : getPlatformId(win); | ||
return capCustomPlatform !== null | ||
? capCustomPlatform.name | ||
: getPlatformId(win); | ||
}; | ||
@@ -136,4 +138,5 @@ const getPlatform = ((_a = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _a === void 0 ? void 0 : _a.getPlatform) || defaultGetPlatform; | ||
}; | ||
const isPluginAvailable = ((_c = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _c === void 0 ? void 0 : _c.isPluginAvailable) || defaultIsPluginAvailable; | ||
const defaultGetPluginHeader = (pluginName) => { var _a; return (_a = cap.PluginHeaders) === null || _a === void 0 ? void 0 : _a.find((h) => h.name === pluginName); }; | ||
const isPluginAvailable = ((_c = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _c === void 0 ? void 0 : _c.isPluginAvailable) || | ||
defaultIsPluginAvailable; | ||
const defaultGetPluginHeader = (pluginName) => { var _a; return (_a = cap.PluginHeaders) === null || _a === void 0 ? void 0 : _a.find(h => h.name === pluginName); }; | ||
const getPluginHeader = ((_d = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _d === void 0 ? void 0 : _d.getPluginHeader) || defaultGetPluginHeader; | ||
@@ -161,3 +164,5 @@ const handleError = (err) => win.console.error(err); | ||
} | ||
else if (capCustomPlatform !== null && !jsImplementation && 'web' in jsImplementations) { | ||
else if (capCustomPlatform !== null && | ||
!jsImplementation && | ||
'web' in jsImplementations) { | ||
jsImplementation = | ||
@@ -173,3 +178,3 @@ typeof jsImplementations['web'] === 'function' | ||
if (pluginHeader) { | ||
const methodHeader = pluginHeader === null || pluginHeader === void 0 ? void 0 : pluginHeader.methods.find((m) => prop === m.name); | ||
const methodHeader = pluginHeader === null || pluginHeader === void 0 ? void 0 : pluginHeader.methods.find(m => prop === m.name); | ||
if (methodHeader) { | ||
@@ -197,3 +202,3 @@ if (methodHeader.rtype === 'promise') { | ||
const wrapper = (...args) => { | ||
const p = loadPluginImplementation().then((impl) => { | ||
const p = loadPluginImplementation().then(impl => { | ||
const fn = createPluginMethod(impl, prop); | ||
@@ -234,3 +239,3 @@ if (fn) { | ||
}; | ||
const p = new Promise((resolve) => call.then(() => resolve({ remove }))); | ||
const p = new Promise(resolve => call.then(() => resolve({ remove }))); | ||
p.remove = async () => { | ||
@@ -263,3 +268,6 @@ console.warn(`Using addListener() without 'await' is deprecated.`); | ||
proxy, | ||
platforms: new Set([...Object.keys(jsImplementations), ...(pluginHeader ? [platform] : [])]), | ||
platforms: new Set([ | ||
...Object.keys(jsImplementations), | ||
...(pluginHeader ? [platform] : []), | ||
]), | ||
}); | ||
@@ -271,3 +279,3 @@ return proxy; | ||
if (!cap.convertFileSrc) { | ||
cap.convertFileSrc = (filePath) => filePath; | ||
cap.convertFileSrc = filePath => filePath; | ||
} | ||
@@ -374,3 +382,3 @@ cap.getPlatform = getPlatform; | ||
} | ||
listeners.forEach((listener) => listener(data)); | ||
listeners.forEach(listener => listener(data)); | ||
} | ||
@@ -385,3 +393,3 @@ hasListeners(eventName) { | ||
pluginEventName, | ||
handler: (event) => { | ||
handler: event => { | ||
this.notifyListeners(pluginEventName, event); | ||
@@ -427,3 +435,3 @@ }, | ||
delete this.retainedEventArguments[eventName]; | ||
args.forEach((arg) => { | ||
args.forEach(arg => { | ||
this.notifyListeners(eventName, arg); | ||
@@ -453,3 +461,3 @@ }); | ||
const cookieMap = {}; | ||
cookies.split(';').forEach((cookie) => { | ||
cookies.split(';').forEach(cookie => { | ||
if (cookie.length <= 0) | ||
@@ -473,3 +481,5 @@ return; | ||
const path = (options.path || '/').replace('path=', ''); // Default is "path=/" | ||
const domain = options.url != null && options.url.length > 0 ? `domain=${options.url}` : ''; | ||
const domain = options.url != null && options.url.length > 0 | ||
? `domain=${options.url}` | ||
: ''; | ||
document.cookie = `${encodedKey}=${encodedValue || ''}${expires}; path=${path}; ${domain};`; | ||
@@ -493,3 +503,5 @@ } | ||
for (const cookie of cookies) { | ||
document.cookie = cookie.replace(/^ +/, '').replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/`); | ||
document.cookie = cookie | ||
.replace(/^ +/, '') | ||
.replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/`); | ||
} | ||
@@ -523,3 +535,5 @@ } | ||
// remove prefix "data:application/pdf;base64," | ||
resolve(base64String.indexOf(',') >= 0 ? base64String.split(',')[1] : base64String); | ||
resolve(base64String.indexOf(',') >= 0 | ||
? base64String.split(',')[1] | ||
: base64String); | ||
}; | ||
@@ -535,3 +549,3 @@ reader.onerror = (error) => reject(error); | ||
const originalKeys = Object.keys(headers); | ||
const loweredKeys = Object.keys(headers).map((k) => k.toLocaleLowerCase()); | ||
const loweredKeys = Object.keys(headers).map(k => k.toLocaleLowerCase()); | ||
const normalized = loweredKeys.reduce((acc, key, index) => { | ||
@@ -557,3 +571,3 @@ acc[key] = headers[originalKeys[index]]; | ||
item = ''; | ||
value.forEach((str) => { | ||
value.forEach(str => { | ||
encodedValue = shouldEncode ? encodeURIComponent(str) : str; | ||
@@ -596,3 +610,4 @@ item += `${key}=${encodedValue}&`; | ||
} | ||
else if (type.includes('multipart/form-data') || options.data instanceof FormData) { | ||
else if (type.includes('multipart/form-data') || | ||
options.data instanceof FormData) { | ||
const form = new FormData(); | ||
@@ -614,3 +629,4 @@ if (options.data instanceof FormData) { | ||
} | ||
else if (type.includes('application/json') || typeof options.data === 'object') { | ||
else if (type.includes('application/json') || | ||
typeof options.data === 'object') { | ||
output.body = JSON.stringify(options.data); | ||
@@ -617,0 +633,0 @@ } |
@@ -114,3 +114,5 @@ /*! Capacitor: https://capacitorjs.com/ - MIT License */ | ||
const defaultGetPlatform = () => { | ||
return capCustomPlatform !== null ? capCustomPlatform.name : getPlatformId(win); | ||
return capCustomPlatform !== null | ||
? capCustomPlatform.name | ||
: getPlatformId(win); | ||
}; | ||
@@ -132,4 +134,5 @@ const getPlatform = ((_a = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _a === void 0 ? void 0 : _a.getPlatform) || defaultGetPlatform; | ||
}; | ||
const isPluginAvailable = ((_c = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _c === void 0 ? void 0 : _c.isPluginAvailable) || defaultIsPluginAvailable; | ||
const defaultGetPluginHeader = (pluginName) => { var _a; return (_a = cap.PluginHeaders) === null || _a === void 0 ? void 0 : _a.find((h) => h.name === pluginName); }; | ||
const isPluginAvailable = ((_c = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _c === void 0 ? void 0 : _c.isPluginAvailable) || | ||
defaultIsPluginAvailable; | ||
const defaultGetPluginHeader = (pluginName) => { var _a; return (_a = cap.PluginHeaders) === null || _a === void 0 ? void 0 : _a.find(h => h.name === pluginName); }; | ||
const getPluginHeader = ((_d = capPlatforms === null || capPlatforms === void 0 ? void 0 : capPlatforms.currentPlatform) === null || _d === void 0 ? void 0 : _d.getPluginHeader) || defaultGetPluginHeader; | ||
@@ -157,3 +160,5 @@ const handleError = (err) => win.console.error(err); | ||
} | ||
else if (capCustomPlatform !== null && !jsImplementation && 'web' in jsImplementations) { | ||
else if (capCustomPlatform !== null && | ||
!jsImplementation && | ||
'web' in jsImplementations) { | ||
jsImplementation = | ||
@@ -169,3 +174,3 @@ typeof jsImplementations['web'] === 'function' | ||
if (pluginHeader) { | ||
const methodHeader = pluginHeader === null || pluginHeader === void 0 ? void 0 : pluginHeader.methods.find((m) => prop === m.name); | ||
const methodHeader = pluginHeader === null || pluginHeader === void 0 ? void 0 : pluginHeader.methods.find(m => prop === m.name); | ||
if (methodHeader) { | ||
@@ -193,3 +198,3 @@ if (methodHeader.rtype === 'promise') { | ||
const wrapper = (...args) => { | ||
const p = loadPluginImplementation().then((impl) => { | ||
const p = loadPluginImplementation().then(impl => { | ||
const fn = createPluginMethod(impl, prop); | ||
@@ -230,3 +235,3 @@ if (fn) { | ||
}; | ||
const p = new Promise((resolve) => call.then(() => resolve({ remove }))); | ||
const p = new Promise(resolve => call.then(() => resolve({ remove }))); | ||
p.remove = async () => { | ||
@@ -259,3 +264,6 @@ console.warn(`Using addListener() without 'await' is deprecated.`); | ||
proxy, | ||
platforms: new Set([...Object.keys(jsImplementations), ...(pluginHeader ? [platform] : [])]), | ||
platforms: new Set([ | ||
...Object.keys(jsImplementations), | ||
...(pluginHeader ? [platform] : []), | ||
]), | ||
}); | ||
@@ -267,3 +275,3 @@ return proxy; | ||
if (!cap.convertFileSrc) { | ||
cap.convertFileSrc = (filePath) => filePath; | ||
cap.convertFileSrc = filePath => filePath; | ||
} | ||
@@ -370,3 +378,3 @@ cap.getPlatform = getPlatform; | ||
} | ||
listeners.forEach((listener) => listener(data)); | ||
listeners.forEach(listener => listener(data)); | ||
} | ||
@@ -381,3 +389,3 @@ hasListeners(eventName) { | ||
pluginEventName, | ||
handler: (event) => { | ||
handler: event => { | ||
this.notifyListeners(pluginEventName, event); | ||
@@ -423,3 +431,3 @@ }, | ||
delete this.retainedEventArguments[eventName]; | ||
args.forEach((arg) => { | ||
args.forEach(arg => { | ||
this.notifyListeners(eventName, arg); | ||
@@ -449,3 +457,3 @@ }); | ||
const cookieMap = {}; | ||
cookies.split(';').forEach((cookie) => { | ||
cookies.split(';').forEach(cookie => { | ||
if (cookie.length <= 0) | ||
@@ -469,3 +477,5 @@ return; | ||
const path = (options.path || '/').replace('path=', ''); // Default is "path=/" | ||
const domain = options.url != null && options.url.length > 0 ? `domain=${options.url}` : ''; | ||
const domain = options.url != null && options.url.length > 0 | ||
? `domain=${options.url}` | ||
: ''; | ||
document.cookie = `${encodedKey}=${encodedValue || ''}${expires}; path=${path}; ${domain};`; | ||
@@ -489,3 +499,5 @@ } | ||
for (const cookie of cookies) { | ||
document.cookie = cookie.replace(/^ +/, '').replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/`); | ||
document.cookie = cookie | ||
.replace(/^ +/, '') | ||
.replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/`); | ||
} | ||
@@ -519,3 +531,5 @@ } | ||
// remove prefix "data:application/pdf;base64," | ||
resolve(base64String.indexOf(',') >= 0 ? base64String.split(',')[1] : base64String); | ||
resolve(base64String.indexOf(',') >= 0 | ||
? base64String.split(',')[1] | ||
: base64String); | ||
}; | ||
@@ -531,3 +545,3 @@ reader.onerror = (error) => reject(error); | ||
const originalKeys = Object.keys(headers); | ||
const loweredKeys = Object.keys(headers).map((k) => k.toLocaleLowerCase()); | ||
const loweredKeys = Object.keys(headers).map(k => k.toLocaleLowerCase()); | ||
const normalized = loweredKeys.reduce((acc, key, index) => { | ||
@@ -553,3 +567,3 @@ acc[key] = headers[originalKeys[index]]; | ||
item = ''; | ||
value.forEach((str) => { | ||
value.forEach(str => { | ||
encodedValue = shouldEncode ? encodeURIComponent(str) : str; | ||
@@ -592,3 +606,4 @@ item += `${key}=${encodedValue}&`; | ||
} | ||
else if (type.includes('multipart/form-data') || options.data instanceof FormData) { | ||
else if (type.includes('multipart/form-data') || | ||
options.data instanceof FormData) { | ||
const form = new FormData(); | ||
@@ -610,3 +625,4 @@ if (options.data instanceof FormData) { | ||
} | ||
else if (type.includes('application/json') || typeof options.data === 'object') { | ||
else if (type.includes('application/json') || | ||
typeof options.data === 'object') { | ||
output.body = JSON.stringify(options.data); | ||
@@ -613,0 +629,0 @@ } |
{ | ||
"name": "@capacitor/core", | ||
"version": "6.1.3-nightly-20241011T150501.0", | ||
"version": "6.2.0", | ||
"description": "Capacitor: Cross-platform apps with JavaScript and the web", | ||
@@ -5,0 +5,0 @@ "homepage": "https://capacitorjs.com", |
@@ -5,3 +5,3 @@ export type { CapacitorGlobal, PermissionState, Plugin, PluginCallback, PluginImplementations, PluginListenerHandle, PluginResultData, PluginResultError, } from './definitions'; | ||
export { WebPlugin, WebPluginConfig, ListenerCallback } from './web-plugin'; | ||
export { CapacitorCookies, CapacitorHttp, WebView, buildRequestInit } from './core-plugins'; | ||
export { CapacitorCookies, CapacitorHttp, WebView, buildRequestInit, } from './core-plugins'; | ||
export type { ClearCookieOptions, DeleteCookieOptions, SetCookieOptions, HttpHeaders, HttpOptions, HttpParams, HttpResponse, HttpResponseType, WebViewPath, WebViewPlugin, } from './core-plugins'; | ||
@@ -8,0 +8,0 @@ export { CapacitorException, ExceptionCode } from './util'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
394310
3664
0