enforce a few eslint rules

This commit is contained in:
JFH
2021-05-13 01:00:09 +02:00
parent 9a5292b467
commit d3974f8f17
148 changed files with 1402 additions and 1398 deletions

View File

@@ -8,11 +8,11 @@ export default {
name: 'xdomain-messaging',
init () {
const svgEditor = this;
const {svgCanvas} = svgEditor;
const { svgCanvas } = svgEditor;
try {
window.addEventListener('message', function (e) {
// We accept and post strings for the sake of IE9 support
if (!e.data || !['string', 'object'].includes(typeof e.data) || e.data.charAt() === '|') {
if (!e.data || ![ 'string', 'object' ].includes(typeof e.data) || e.data.charAt() === '|') {
return;
}
const data = typeof e.data === 'object' ? e.data : JSON.parse(e.data);
@@ -22,13 +22,13 @@ export default {
// The default is not to allow any origins, including even the same domain or
// if run on a `file:///` URL. See `svgedit-config-es.js` for an example of how
// to configure
const {allowedOrigins} = svgEditor.configObj.curConfig;
const { allowedOrigins } = svgEditor.configObj.curConfig;
if (!allowedOrigins.includes('*') && !allowedOrigins.includes(e.origin)) {
console.log(`Origin ${e.origin} not whitelisted for posting to ${window.origin}`);
console.log(`Origin ${e.origin} not whitelisted for posting to ${window.origin}`);
return;
}
const cbid = data.id;
const {name, args} = data;
const { name, args } = data;
const message = {
namespace: 'svg-edit',
id: cbid
@@ -43,7 +43,7 @@ export default {
e.source.postMessage(JSON.stringify(message), '*');
});
} catch (err) {
console.log('Error with xdomain message listener: ' + err);
console.log('Error with xdomain message listener: ' + err);
}
}
};