Feature/#35 build tools #36

Merged
Serraniel merged 41 commits from feature/#35-build-tools into develop 2020-09-06 21:20:03 +02:00
2 changed files with 11 additions and 1 deletions
Showing only changes of commit 75f8869f7f - Show all commits

View file

@ -1,3 +1,5 @@
import * as helper from './helpers';
let __scripts = [];
let __afterLoadScripts = [];
@ -16,7 +18,7 @@ export function initCore() {
attributes: true
});
document.addEventListener("DOMContentLoaded", event => awaitPageLoaded(), false);
helper.onReady(() => awaitPageLoaded());
}
export function registerScript(func, pattern = '.*') {

View file

@ -10,6 +10,14 @@ export function initHelpers() {
document.addEventListener('keyup', event => handleKeyUp(event));
}
export function onReady(fn) {
if (document.readyState != 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
function handleKeyDown(event) {
handleKeyToggle(event, true);
}