- Linting (ESLint): Remove now unneeded config and add per new update

- Refactoring: Prefer for-of, event.key (newly enforced linting)
- Refactoring: Better var. names
- npm: Update devDeps and update local copies
This commit is contained in:
Brett Zamir
2019-05-24 20:17:17 +08:00
parent f6b5360a58
commit 4177146acd
38 changed files with 2450 additions and 1476 deletions

View File

@@ -314,19 +314,17 @@ class EmbeddedSVGEdit {
];
// TODO: rewrite the following, it's pretty scary.
for (let i = 0; i < functions.length; i++) {
this[functions[i]] = getCallbackSetter(functions[i]);
for (const func of functions) {
this[func] = getCallbackSetter(func);
}
// Older IE may need a polyfill for addEventListener, but so it would for SVG
window.addEventListener('message', getMessageListener(this));
window.addEventListener('keydown', (e) => {
const {key, keyCode, charCode, which} = e;
if (e.key === 'Backspace') {
const {type, key} = e;
if (key === 'Backspace') {
e.preventDefault();
const keyboardEvent = new KeyboardEvent(e.type, {
key, keyCode, charCode, which
});
const keyboardEvent = new KeyboardEvent(type, {key});
that.frame.contentDocument.dispatchEvent(keyboardEvent);
}
});