elm-pass/extension/portal.js
2018-02-01 20:04:00 -05:00

20 lines
503 B
JavaScript

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);
});