mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 04:09:59 +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
06bff7da09
commit
b4b3c1f0d4
1 changed files with 4 additions and 6 deletions
|
@ -191,7 +191,7 @@ class KeyShortcutModifiers {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new KeyShortcutModifiers(
|
return new KeyShortcutModifiers(
|
||||||
modifiers['control'] == true,
|
modifiers['ctrl'] == true,
|
||||||
modifiers['alt'] == true,
|
modifiers['alt'] == true,
|
||||||
modifiers['shift'] == true,
|
modifiers['shift'] == true,
|
||||||
modifiers['meta'] == true || modifiers['accel'] == true
|
modifiers['meta'] == true || modifiers['accel'] == true
|
||||||
|
@ -203,8 +203,6 @@ class KeyShortcutModifiers {
|
||||||
return new KeyShortcutModifiers(false, false, false, false);
|
return new KeyShortcutModifiers(false, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(modifiers);
|
|
||||||
|
|
||||||
return new KeyShortcutModifiers(
|
return new KeyShortcutModifiers(
|
||||||
modifiers.includes('control') || modifiers.includes('accel'),
|
modifiers.includes('control') || modifiers.includes('accel'),
|
||||||
modifiers.includes('alt'),
|
modifiers.includes('alt'),
|
||||||
|
@ -233,7 +231,7 @@ class KeyShortcutModifiers {
|
||||||
toString() {
|
toString() {
|
||||||
let str = '';
|
let str = '';
|
||||||
if (this.#ctrl) {
|
if (this.#ctrl) {
|
||||||
str += 'control,';
|
str += 'accel,';
|
||||||
}
|
}
|
||||||
if (this.#alt) {
|
if (this.#alt) {
|
||||||
str += 'alt,';
|
str += 'alt,';
|
||||||
|
@ -574,11 +572,11 @@ var gZenKeyboardShortcutsManager = {
|
||||||
await this._saveShortcuts();
|
await this._saveShortcuts();
|
||||||
},
|
},
|
||||||
|
|
||||||
getModifiableShortcuts() {
|
async getModifiableShortcuts() {
|
||||||
let rv = [];
|
let rv = [];
|
||||||
|
|
||||||
if (!this._currentShortcutList) {
|
if (!this._currentShortcutList) {
|
||||||
this._currentShortcutList = this._loadSaved();
|
this._currentShortcutList = await this._loadSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let shortcut of this._currentShortcutList) {
|
for (let shortcut of this._currentShortcutList) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue