Fixed tab unloader pref not being updated (closes https://github.com/zen-browser/desktop/issues/1835)

This commit is contained in:
mauro-balades
2024-10-04 18:29:44 +02:00
parent 4adde6ba85
commit 5d0ea6a2c3

View File

@@ -616,9 +616,19 @@ var gZenLooksAndFeel = {
var gZenWorkspacesSettings = {
init() {
var tabsUnloaderPrefListener = {
async observe(subject, topic, data) {
let buttonIndex = await confirmRestartPrompt(true, 1, true, true);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
}
}
Services.prefs.addObserver('zen.workspaces.enabled', this);
Services.prefs.addObserver('zen.tab-unloader.enabled', tabsUnloaderPrefListener);
window.addEventListener('unload', () => {
Services.prefs.removeObserver('zen.workspaces.enabled', this);
Services.prefs.removeObserver('zen.tab-unloader.enabled', tabsUnloaderPrefListener);
});
},