Skip to content

Commit

Permalink
Remove circular dependencies in framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
TekMonksGitHub committed Jan 30, 2024
1 parent 60a5aa3 commit a08a9ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build_number
Original file line number Diff line number Diff line change
@@ -1 +1 @@
777
778
7 changes: 4 additions & 3 deletions frontend/framework/js/i18n.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* (C) 2018-2021 TekMonks. All rights reserved.
* License: See enclosed LICENSE file.
*/
import {router} from "/framework/js/router.mjs";
import {session} from "/framework/js/session.mjs";

const i18n_SESSION_KEY = "__org_monkshu_i18n_session_key__", APP_PATHS_SESSION_KEY = "__org_monkshu_i18n_app_paths";
Expand All @@ -20,8 +19,10 @@ const addPath = additionalPath => {
_setI18NSessionObject(i18nObject); /* need to recache */
}

const getRendered = async (key, data, language=getSessionLang(), refresh=false) => (await router.getMustache()).render(
await get(key, language, refresh), data);
const getRendered = async (key, data, language=getSessionLang(), refresh=false) => {
const {router} = await import("/framework/js/router.mjs");
return (await router.getMustache()).render(await get(key, language, refresh), data);
}

async function get(key, language=getSessionLang(), refresh=false) {
try {
Expand Down
2 changes: 1 addition & 1 deletion frontend/framework/js/pwasupport.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* License: See enclosed LICENSE file.
*/
import {util} from "./util.mjs";
import {router} from "./router.mjs";
import {blackboard} from "/framework/js/blackboard.mjs";

const FRAMEWORK_FILELIST = `/framework/${$$.MONKSHU_CONSTANTS.CACHELIST_SUFFIX}`,
Expand Down Expand Up @@ -125,6 +124,7 @@ async function _versionChecker(appName, manifestOld, manifestNew, listOfFilesToC
serviceWorker.postMessage({id: $$.MONKSHU_CONSTANTS.CACHEWORKER_MSG, op: "unserveAllVersionsExcept",
appName, except_version: manifestNew.version});

const {router} = await import("/framework/js/router.mjs");
if (postSwitchActions.length) for (const action of postSwitchActions) action();
else setTimeout(router.hardreload, PAGE_RELOAD_ON_UPGRADE_INTERVAL); // else hard reload in 0.5 seconds - this gives time to the service worker to switch cache and request handlers
});
Expand Down

0 comments on commit a08a9ba

Please sign in to comment.