Skip to content

Commit

Permalink
Fix reference before declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Sep 13, 2023
1 parent b79980a commit a7e3e08
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/renderer/src/electron/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateURLParams } from "../globals.js";
import { updateURLParams } from "../../utils/url.js";
import isElectron from "./check.js";

export { isElectron };
Expand Down
16 changes: 1 addition & 15 deletions src/renderer/src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,4 @@ export let runOnLoad = (fn) => {
// Base Request URL for Python Server
export const baseUrl = `http://127.0.0.1:${port}`;

export const supportedInterfaces = guideGlobalMetadata.supported_interfaces;

export function updateURLParams(paramsToUpdate) {
const params = new URLSearchParams(location.search);
for (let key in paramsToUpdate) {
const value = paramsToUpdate[key];
if (value == undefined) params.delete(key);
else params.set(key, value);
}

// Update browser history state
const value = `${location.pathname}?${params}`;
if (history.state) Object.assign(history.state, paramsToUpdate);
window.history.pushState(history.state, null, value);
}
export const supportedInterfaces = guideGlobalMetadata.supported_interfaces;
3 changes: 2 additions & 1 deletion src/renderer/src/progress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import {
conversionSaveFolderPath,
} from "../dependencies/simple.js";
import { fs } from "../electron/index.js";
import { joinPath, runOnLoad, updateURLParams } from "../globals.js";
import { joinPath, runOnLoad } from "../globals.js";
import { merge } from "../stories/pages/utils.js";
import { updateAppProgress, updateFile } from "./update.js";
import { updateURLParams } from "../../utils/url.js";

export * from "./update";

Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/progress/update.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { updateURLParams } from "../../utils/url.js";
import { guidedProgressFilePath } from "../dependencies/simple.js";
import { fs } from "../electron/index.js";
import { joinPath, updateURLParams } from "../globals.js";
import { joinPath } from "../globals.js";
import { get } from "./index.js";

export const update = (newDatasetName, previousDatasetName) => {
Expand Down
14 changes: 14 additions & 0 deletions src/renderer/utils/url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

export function updateURLParams(paramsToUpdate) {
const params = new URLSearchParams(location.search);
for (let key in paramsToUpdate) {
const value = paramsToUpdate[key];
if (value == undefined) params.delete(key);
else params.set(key, value);
}

// Update browser history state
const value = `${location.pathname}?${params}`;
if (history.state) Object.assign(history.state, paramsToUpdate);
window.history.pushState(history.state, null, value);
}

0 comments on commit a7e3e08

Please sign in to comment.