Skip to content

Commit

Permalink
Refactor: code for settings window is now scalable
Browse files Browse the repository at this point in the history
  • Loading branch information
blahsd committed May 28, 2018
1 parent 5ffca9f commit e8870d2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ window.onload=function() {
loadSettings(["theme","colorscheme"]);
setSettingButtonValue();

const buttons = ["player", "theme", "colorscheme"];

buttons.forEach( button => {
document.getElementById(`${button}-form`).addEventListener("click", function(e) {
saveSettingButtonValue(`${button}`);
require('electron').remote.getCurrentWebContents().emit("changeSettingEvent");
loadSettings();
})
})


/*
document.getElementById("theme-form").addEventListener("click", function(e) {
saveSettingButtonValue("theme");
require('electron').remote.getCurrentWebContents().emit("changeSettingEvent");
Expand All @@ -27,4 +36,5 @@ window.onload=function() {
console.log(document.title + " emitted a changeSettingEvent event!");
loadSettings();
})
*/
}

0 comments on commit e8870d2

Please sign in to comment.