const container = document.querySelector('#app'); const app = Elm.App.embed(container); app.ports.loadConfig.subscribe(() => { chrome.storage.sync.get( [ 'server', 'token', 'owner', 'repo' ], (config) => { app.ports.config.send(Object.keys(config).length < 4 ? null : config); }); }); app.ports.saveConfig.subscribe((config) => { chrome.storage.sync.set(config); });