Feature/#35 build tools #36
|
@ -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 = '.*') {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue