Commit 2d326d3f authored by Tim Zallmann's avatar Tim Zallmann

Checks the page route for shortcut init

Apply 1 suggestion(s) to 1 file(s)
Prettified shortcuts.js after applied suggestion
parent 11de28fd
import Shortcuts from './shortcuts/shortcuts';
export default function initPageShortcuts() {
const { page } = document.body.dataset;
const pagesWithCustomShortcuts = [
......@@ -29,7 +27,9 @@ export default function initPageShortcuts() {
// the pages above have their own shortcuts sub-classes instantiated elsewhere
// TODO: replace this whitelist with something more automated/maintainable
if (page && !pagesWithCustomShortcuts.includes(page)) {
return new Shortcuts();
import(/* webpackChunkName: 'shortcutsBundle' */ './shortcuts/shortcuts')
.then(({ default: Shortcuts }) => new Shortcuts())
.catch(() => {});
}
return false;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment