diff --git a/package.json b/package.json index 51a3a78..3e1f755 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "webpack": "^5.38.1", "webpack-cli": "^4.7.0", "webpack-dev-server": "^3.11.2", - "z-pagerouter": "^1.0.5" + "z-pagerouter": "^1.0.6" }, "dependencies": { "css-minimizer-webpack-plugin": "^3.0.0" diff --git a/src/main.tsx b/src/main.tsx index 0ee5f22..aa34724 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -52,15 +52,14 @@ async function onLoad(): Promise { pageTitleElement: document.querySelector("#pageTitle"), pageContentElement: document.querySelector("#pageContent"), resetElementContent: !true, + onPageChanged: async function (_) { + pageState.currentPage = await pageRouter.getCurrentPageID(); + document.documentElement.dir = pageState.pageDirection; + }, }); reloadNavBar(pageRouter); - pageRouter.addEventListener("pageChanged", async function (_) { - pageState.currentPage = await pageRouter.getCurrentPageID(); - document.documentElement.dir = pageState.pageDirection; - }); - if (process.env.NODE_ENV == "development") { await playground(pageRouter); }