custom-openstreetmap-tile-s.../settings/settings.js
2020-07-03 21:08:10 +02:00

24 lines
601 B
JavaScript

function saveOptions(e) {
e.preventDefault();
browser.storage.local.set({
tileserver: document.querySelector("#tileserver").value
});
}
function restoreOptions() {
function setCurrentChoice(result) {
document.querySelector("#tileserver").value = result.tileserver || "";
}
function onError(error) {
console.log(`Error: ${error}`);
}
var getting = browser.storage.local.get("tileserver");
getting.then(setCurrentChoice, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);