From 47f653217156f091c98aee1f67f3b4e97dd316c4 Mon Sep 17 00:00:00 2001 From: "Felix W. Dekker" Date: Thu, 15 Apr 2021 23:02:30 +0200 Subject: [PATCH] Use different method for exporting JS --- package.json | 2 +- src/main/js/main.js | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 26d0572..993251c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fwdekker/template", - "version": "1.0.0", + "version": "1.0.1", "description": "The base template for pages on fwdekker.com.", "author": "Felix W. Dekker (https://fwdekker.com)", "license": "MIT", diff --git a/src/main/js/main.js b/src/main/js/main.js index c7f0834..fcb1876 100644 --- a/src/main/js/main.js +++ b/src/main/js/main.js @@ -15,7 +15,7 @@ const stringToHtml = function (string, query) { * @param q {string} the query string * @returns {HTMLElement} the element identified by the query string */ -export const $ = q => document.querySelector(q); +const $ = q => document.querySelector(q); /** * Runs the given function once the page is loaded. @@ -25,16 +25,16 @@ export const $ = q => document.querySelector(q); * * @param fun {function(...*): *} the function to run */ -export const doAfterLoad = function (fun) { +const doAfterLoad = function (fun) { if (document.readyState === "complete") { fun(); return; } - const oldOnLoad = window.onload || (() => { + const oldOnLoad = onload || (() => { }); - window.onload = (() => { + onload = (() => { oldOnLoad(); fun(); }); @@ -49,7 +49,7 @@ export const doAfterLoad = function (fun) { * @param [highlightPath] {String} the path to highlight together with its parents * @returns {HTMLElement} a base navigation element that will eventually be filled with contents */ -export const nav = function (highlightPath = "") { +const nav = function (highlightPath = "") { const base = stringToHtml( `