urbit-browser-manager/extension/popup/popup.js
ronreg-ribdev 703a0cd630 Get rid of src/ dir
don't need this layer of indirection
2021-01-02 23:47:15 -08:00

19 lines
585 B
JavaScript

const browser = require("webextension-polyfill");
console.log("popup.js running");
const getLocalStorage = browser.storage.sync.get();
document.querySelector("#options").addEventListener("click", () => {
browser.runtime.openOptionsPage();
});
getLocalStorage.then((result) => {
const loggedInSelector = document.querySelector("#loggedInMsg");
if (result.credentials && result.credentials.urbitId && result.credentials.urbitCode) {
loggedInSelector.textContent = `Hi, ~${result.credentials.urbitId}`;
} else {
loggedInSelector.textContent = "Not logged in";
}
});