Made some changes to options script

This commit is contained in:
Joe Jarvis 2017-02-07 18:38:33 -05:00
parent 6a3c6e74c5
commit d8c62d8861

View file

@ -1,16 +1,11 @@
function saveOptions(e) {
browser.storage.local.set({
days: document.querySelector("#days").value
});
e.preventDefault();
browser.storage.local.set({days: document.querySelector("#days").value});
e.preventDefault();
}
function restoreOptions() {
var gettingItem = browser.storage.local.get('days');
gettingItem.then((res) => {
document.querySelector("#days").value = res.days || '0';
});
browser.storage.local.get('days', function(res) {
document.querySelector("#days").value = res.days || '0';
});
}
document.addEventListener('DOMContentLoaded', restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);