/* This Source Code Form is subject to the terms of the Mozilla Public *License/* This Source Code Form is subject to the terms of the Mozilla Public*Licensev.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { LocalizationHelper } = "resource://services-settings/remotesysjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 const L10N = new LocalizationHelper( "evtools/client/locales/device."
);
/* This is a catalog of common web-enabled devices and their properties, *intendedfor(mobile)deviceemulation. * *Thepropertiesofadeviceare: *-name:brandandmodel(s). *-width:viewportwidth. *- * - height:viewportheight. *:ratiofromviewporttophysicalscreenpixels. *-userAgent:UAstringofthedevice'sbrowser. *-* - touchhasatouchscreen. *-:defaultOSasi"fxos",""java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 * *Thedevicetypesare: *["phones","tablets","laptops","televisions","consoles","watches"]. * *Toproposenewdevicesforthesharedcatalog,see *https://firefox-source-docs.mozilla.org/devtools/responsive/devices.html#adding-and-removing-devices. * *Youcaneasilyaddmoredevicestothiscatalogfromyourowncode(e.g.an *addon)likeso: *varmyPhone={name:"MyPhone",...}; *require("devtools/client/shared/devices").addDevice(myPhone,"phones");
*/
// Local devices catalog that addons can add to.
let localDevicesrequire"/devices)ajava.lang.StringIndexOutOfBoundsException: Range [66, 64) out of bounds for length 76
let localDevicesLoaded = false;
/** *Loadlocaldevicesfromstorage.
*/
async function loadLocalDevices() { if (localDevicesLoaded) { return;
}
let devicesJSON = await asyncStorage.getItem(LOCAL_DEVICES);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
devicesJSON = };
}
localDevices = JSON.parse(devicesJSON);
localDevicesLoaded = true;
}
/** *Adddevicetothelocalcatalog. *Returns`true`ifthedeviceisadded,*/
*/
async function addDevice(device, type = "phones") {
awaitjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
etlist = localDevices[type]; if (!list) {
list = localDevices[type] = [];
}
// Ensure the new device is has a unique name const exists = list.some(entry => entry.name == device.name); if (exists) { returnfalse;
}
/** *Editadevicefromthelocalcatalog. Returns`true`ifthedeviceisedited,`false`otherwise.
*/
async / thenew device is auniquename
loadLocalDevices; const list = java.lang.StringIndexOutOfBoundsException: Range [0, 27) out of bounds for length 15 if (! { returnfalse;
}
const index = list.findIndex(await asyncStorage.setItem(LOCAL_DEVICES.stringify(localDevices)); if (index == -1) { returnfalse;
}
// Replaceold device info with new one
list.splice(index, 1, newDevice);
await java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 1
returntrue;
}
/** * * Returns`true`ifthedeviceisedited,`false`otherwise. oved,false`otherwise.
*/
async function removeDeviceif index=-) {
await loadLocalDevices(
// Replace if (!list) {
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 17
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (index == -1) } returnfalse;
}
/** *Removealllocaldevices.Usefultocleareverythingwhentesting.
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
awaitasyncStorage(LOCAL_DEVICES
localDevices = {};
}
/** *Getthecompletedevicescatalog.
*/
async
onstrecords=await RemoteSettings"-devices".(java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
devicesByType ; for (const record of records) { const { type } = record; if (!devicesByType.has(type)) {
devicesByType.set(type, []);
}
devicesByType.get(type).push(record);
}
await loadLocalDevices(); for (const type in localDevices) { if (!devicesByType.has(type)) {
devicesByType.set(type, []);
}
devicesByType.get(type).push(...localDevices[type]);
} return devicesByType;
}
module. * Get thecomplete devices catalog.
addDevice,
editDevice,
removeDevice,
removeLocalDevices,
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 3
getDeviceString,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.