From aa7e2a3457b75e72df21b5e70478ecde9159443b Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Fri, 6 Jul 2018 23:01:08 -0400 Subject: [PATCH] Don't close the window until the new value is set. --- src/options.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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); -- 2.51.2