mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 17:40:00 +02:00
refactor: Simplify workspace initialization logic
This commit is contained in:
parent
06134b02e0
commit
82824a1716
1 changed files with 11 additions and 7 deletions
|
@ -9,10 +9,10 @@ var ZenWorkspaces = {
|
||||||
return; // We are in a hidden window, don't initialize ZenWorkspaces
|
return; // We are in a hidden window, don't initialize ZenWorkspaces
|
||||||
}
|
}
|
||||||
console.info("ZenWorkspaces: Initializing ZenWorkspaces...");
|
console.info("ZenWorkspaces: Initializing ZenWorkspaces...");
|
||||||
setTimeout(async () => {
|
window.SessionStore.promiseInitialized.then(async () => {
|
||||||
await this.initializeWorkspaces();
|
await this.initializeWorkspaces();
|
||||||
console.info("ZenWorkspaces: ZenWorkspaces initialized");
|
console.info("ZenWorkspaces: ZenWorkspaces initialized");
|
||||||
}, 0);
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
get workspaceEnabled() {
|
get workspaceEnabled() {
|
||||||
|
@ -50,8 +50,10 @@ var ZenWorkspaces = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async initializeWorkspaces() {
|
async initializeWorkspaces(init = false) {
|
||||||
Services.prefs.addObserver("zen.workspaces.enabled", this.onWorkspacesEnabledChanged.bind(this));
|
if (init) {
|
||||||
|
Services.prefs.addObserver("zen.workspaces.enabled", this.onWorkspacesEnabledChanged.bind(this));
|
||||||
|
}
|
||||||
this.initializeWorkspacesButton();
|
this.initializeWorkspacesButton();
|
||||||
let file = new FileUtils.File(this._storeFile);
|
let file = new FileUtils.File(this._storeFile);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
@ -76,9 +78,11 @@ var ZenWorkspaces = {
|
||||||
}
|
}
|
||||||
this.changeWorkspace(activeWorkspace, true);
|
this.changeWorkspace(activeWorkspace, true);
|
||||||
}
|
}
|
||||||
this._initializeWorkspaceCreationIcons();
|
if (init) {
|
||||||
this._initializeWorkspaceEditIcons();
|
this._initializeWorkspaceCreationIcons();
|
||||||
this._initializeWorkspaceTabContextMenus();
|
this._initializeWorkspaceEditIcons();
|
||||||
|
this._initializeWorkspaceTabContextMenus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue