diff --git a/src/ui.js b/src/ui.js index 7321b0f2..f116d68f 100644 --- a/src/ui.js +++ b/src/ui.js @@ -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');