Skip to content

Commit

Permalink
automatic option panel UI update
Browse files Browse the repository at this point in the history
  • Loading branch information
throwaway96 committed Mar 29, 2024
1 parent 711dd34 commit a8ed86b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,16 @@ function createConfigCheckbox(key) {
const elmInput = document.createElement('input');
elmInput.type = 'checkbox';
elmInput.checked = configRead(key);
elmInput.addEventListener('change', (evt) => {

/** @type {(evt: Event) => void} */
const changeHandler = (evt) => {
configWrite(key, evt.target.checked);
};

elmInput.addEventListener('change', changeHandler);

configAddChangeListener(key, (evt) => {
elmInput.checked = evt.detail.newValue;
});

const elmLabel = document.createElement('label');
Expand Down

0 comments on commit a8ed86b

Please sign in to comment.