elm-pass/extension/portal.js

21 lines
503 B
JavaScript
Raw Normal View History

2018-01-26 21:12:07 +00:00
const container = document.querySelector('#app');
const app = Elm.App.embed(container);
2018-02-01 23:28:31 +00:00
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);
});