mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 01:20:00 +02:00
Refactor ZenKeyboardShortcuts to use async/await for initialization and handle potential error when retrieving active workspace from cache
This commit is contained in:
parent
a97e7e65ed
commit
58b7b402ac
2 changed files with 3 additions and 6 deletions
|
@ -463,6 +463,7 @@ var gZenKeyboardShortcutsStorage = new class {
|
|||
var gZenKeyboardShortcutsManager = {
|
||||
async init() {
|
||||
if (window.location.href == 'chrome://browser/content/browser.xhtml') {
|
||||
await SessionStore.promiseInitialized;
|
||||
console.info('Zen CKS: Initializing shortcuts');
|
||||
|
||||
this._currentShortcutList = await this._loadSaved();
|
||||
|
|
|
@ -365,19 +365,15 @@ var ZenWorkspaces = {
|
|||
button.removeAttribute('hidden');
|
||||
return;
|
||||
}
|
||||
const nextSibling = document.getElementById('zen-sidepanel-button');
|
||||
const wrapper = document.createXULElement('toolbarbutton');
|
||||
wrapper.id = 'zen-workspaces-button';
|
||||
nextSibling.after(wrapper);
|
||||
await this._expandWorkspacesStrip();
|
||||
},
|
||||
|
||||
async _expandWorkspacesStrip() {
|
||||
let workspaces = await this._workspaces();
|
||||
let workspaceList = document.getElementById('zen-workspaces-button');
|
||||
const newWorkspacesButton = document.createXULElement(this.shouldShowIconStrip ? 'hbox' : 'toolbarbutton');
|
||||
const newWorkspacesButton = document.createXULElement('toolbarbutton');
|
||||
newWorkspacesButton.id = 'zen-workspaces-button';
|
||||
newWorkspacesButton.setAttribute('removable', 'false');
|
||||
newWorkspacesButton.setAttribute('removable', 'true');
|
||||
newWorkspacesButton.setAttribute('showInPrivateBrowsing', 'false');
|
||||
newWorkspacesButton.setAttribute('tooltiptext', 'Workspaces');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue