import {flags} from ./adapptypes.ts

cache := await browser.storage.local.get flags

for each box of flags
   checkbox := document.getElementById(box) as HTMLInputElement
   unless checkbox then continue
   checkbox.checked = cache[box] ?? false

document.body.addEventListener 'click', (event) ->
   elt := event.target as HTMLInputElement
   unless elt.tagName is 'INPUT' and elt.type is 'checkbox' then return
   browser.storage.local.set [elt.id]: elt.checked
