mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 23:15:29 +02:00
Refactor ZenWorkspaces to use async/await for shortcutSwitchTo method
This commit is contained in:
parent
b4b3c1f0d4
commit
a97e7e65ed
2 changed files with 325 additions and 208 deletions
|
@ -833,5 +833,12 @@ var ZenWorkspaces = {
|
|||
}
|
||||
return [activeWorkspaceUserContextId, true];
|
||||
},
|
||||
|
||||
async shortcutSwitchTo(index) {
|
||||
const workspaces = await this._workspaces();
|
||||
// The index may be out of bounds, so we need to wrap it around
|
||||
const workspaceToSwitch = workspaces.workspaces[(index + workspaces.workspaces.length) % workspaces.workspaces.length];
|
||||
await this.changeWorkspace(workspaceToSwitch);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue