diff --git a/src/options.js b/src/options.js index 2dc71a0..8c2dfc6 100644 --- a/src/options.js +++ b/src/options.js @@ -25,10 +25,15 @@ const saveOptions = (e) => { e.preventDefault(); const inputValue = tabLimitInput().value; const newTabLimit = +inputValue > 0 ? +inputValue : defaultTabLimit; - browser.storage.local.set({[tabLimitStorageKey]: newTabLimit}); - // if the user enters an invalid value, make sure the form reflects the default value - setTabLimitInputValue(newTabLimit); - window.close(); + browser + .storage + .local + .set({[tabLimitStorageKey]: newTabLimit}) + .then(() => { + // if the user enters an invalid value, make sure the form reflects the default value + setTabLimitInputValue(newTabLimit); + window.close(); + }); }; const restoreOptions = () => getTabLimit().then(setTabLimitInputValue);