Rename .js/.jsx to .ts/.tsx
This commit is contained in:
parent
257162e5b6
commit
c60d0e7392
151 changed files with 0 additions and 0 deletions
29
src/background/usecases/AddonEnabledUseCase.ts
Normal file
29
src/background/usecases/AddonEnabledUseCase.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import IndicatorPresenter from '../presenters/IndicatorPresenter';
|
||||
import TabPresenter from '../presenters/TabPresenter';
|
||||
import ContentMessageClient from '../infrastructures/ContentMessageClient';
|
||||
|
||||
export default class AddonEnabledUseCase {
|
||||
constructor() {
|
||||
this.indicatorPresentor = new IndicatorPresenter();
|
||||
|
||||
this.indicatorPresentor.onClick(tab => this.onIndicatorClick(tab.id));
|
||||
|
||||
this.tabPresenter = new TabPresenter();
|
||||
this.tabPresenter.onSelected(info => this.onTabSelected(info.tabId));
|
||||
|
||||
this.contentMessageClient = new ContentMessageClient();
|
||||
}
|
||||
|
||||
indicate(enabled) {
|
||||
return this.indicatorPresentor.indicate(enabled);
|
||||
}
|
||||
|
||||
onIndicatorClick(tabId) {
|
||||
return this.contentMessageClient.toggleAddonEnabled(tabId);
|
||||
}
|
||||
|
||||
async onTabSelected(tabId) {
|
||||
let enabled = await this.contentMessageClient.getAddonEnabled(tabId);
|
||||
return this.indicatorPresentor.indicate(enabled);
|
||||
}
|
||||
}
|
Reference in a new issue