summary refs log tree commit diff
path: root/pages.js
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-11-30 18:11:32 +0200
committerWlodekM <[email protected]>2024-11-30 18:11:32 +0200
commit97157622be86c68f69e6e48f3746ca2c70b7e8a8 (patch)
tree32fe8069343d2b41f01b2d58325942fb43864056 /pages.js
initial commit
Diffstat (limited to 'pages.js')
-rw-r--r--pages.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/pages.js b/pages.js
new file mode 100644
index 0000000..1d48894
--- /dev/null
+++ b/pages.js
@@ -0,0 +1,13 @@
+export let page = ""
+
+let currPageData = null
+
+export async function goToPage(pageA) {
+    if(currPageData?.onunload) currPageData.onunload();
+    page = pageA;
+    let pageHTML = await (await fetch("./pages/"+pageA+"/page.html")).text();
+    document.querySelector(".main").innerHTML = pageHTML
+    let pageData = await import("./pages/"+pageA+"/page.js");
+    currPageData = pageData;
+    if(pageData?.onload) pageData.onload();
+}
\ No newline at end of file