diff options
Diffstat (limited to 'src/background/operators/impls/SelectPreviousSelectedTabOperator.ts')
-rw-r--r-- | src/background/operators/impls/SelectPreviousSelectedTabOperator.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/background/operators/impls/SelectPreviousSelectedTabOperator.ts b/src/background/operators/impls/SelectPreviousSelectedTabOperator.ts new file mode 100644 index 0000000..03a778d --- /dev/null +++ b/src/background/operators/impls/SelectPreviousSelectedTabOperator.ts @@ -0,0 +1,14 @@ +import Operator from "../Operator"; +import TabPresenter from "../../presenters/TabPresenter"; + +export default class SelectPreviousSelectedTabOperator implements Operator { + constructor(private readonly tabPresenter: TabPresenter) {} + + async run(): Promise<void> { + const tabId = await this.tabPresenter.getLastSelectedId(); + if (tabId === null || typeof tabId === "undefined") { + return Promise.resolve(); + } + return this.tabPresenter.select(tabId); + } +} |