Skip to content

Commit

Permalink
save and load profile
Browse files Browse the repository at this point in the history
Signed-off-by: Johnny On <[email protected]>
  • Loading branch information
johnnyon-amzn committed May 16, 2022
1 parent a532a94 commit 0db223d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/configPreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contextBridge.exposeInMainWorld(
onName: (fn) => {
ipcRenderer.on("name", (event, ...args) => fn(...args));
},
getConfig: (name) => config.getConfig(name),
getConfig: (name) => configLibrary.getConfig(name),
setConfig: (config, callback) => configLibrary.setConfig(config, callback),

}
Expand Down
2 changes: 1 addition & 1 deletion src/configRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function init() {
}

// store name variable if exists
window.electron.onName(function (event, name) {
window.electron.onName(function (name) {
let config = window.electron.getConfig(name);
populateFields(config);
});
Expand Down
8 changes: 5 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function createConfigWindow() {

win.loadFile("./src/configManager.html");
win.webContents.openDevTools();
return win;
}

async function viewOSD() {
Expand All @@ -49,9 +50,10 @@ ipcMain.handle('swapURL', async (event, arg) => {
})

ipcMain.handle('openConfig', async (event, name) => {
let configWindow = createConfigWindow();
configWindow.webContents.send('name', name);

var configWindow = createConfigWindow();
if (name) {
configWindow.webContents.send('name', name);
}
})

ipcMain.handle('closeWindow', async (event, arg) => {
Expand Down
6 changes: 6 additions & 0 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ function addListeners() {
window.electron.ipcRenderer.invoke("openConfig");

})
let editConfig = document.getElementById("editConfig");
editConfig.addEventListener("click", async (event) => {
event.preventDefault();
var name = profile.options[profile.selectedIndex].value;
window.electron.ipcRenderer.invoke("openConfig", name);
})

let submit = document.getElementById("submit");

Expand Down

0 comments on commit 0db223d

Please sign in to comment.