Use TSyringe on background script
This commit is contained in:
parent
c7803e7c29
commit
cdfd54ed99
37 changed files with 212 additions and 202 deletions
|
@ -1,5 +1,7 @@
|
|||
import { injectable } from 'tsyringe';
|
||||
import * as messages from '../../shared/messages';
|
||||
|
||||
@injectable()
|
||||
export default class ConsoleClient {
|
||||
showCommand(tabId: number, command: string): Promise<any> {
|
||||
return browser.tabs.sendMessage(tabId, {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { injectable } from 'tsyringe';
|
||||
import * as messages from '../../shared/messages';
|
||||
|
||||
@injectable()
|
||||
export default class ContentMessageClient {
|
||||
async broadcastSettingsChanged(): Promise<void> {
|
||||
let tabs = await browser.tabs.query({});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { injectable } from 'tsyringe';
|
||||
import * as messages from '../../shared/messages';
|
||||
import CompletionGroup from '../domains/CompletionGroup';
|
||||
import CommandController from '../controllers/CommandController';
|
||||
|
@ -8,32 +9,19 @@ import LinkController from '../controllers/LinkController';
|
|||
import OperationController from '../controllers/OperationController';
|
||||
import MarkController from '../controllers/MarkController';
|
||||
|
||||
@injectable()
|
||||
export default class ContentMessageListener {
|
||||
private settingController: SettingController;
|
||||
|
||||
private commandController: CommandController;
|
||||
|
||||
private findController: FindController;
|
||||
|
||||
private addonEnabledController: AddonEnabledController;
|
||||
|
||||
private linkController: LinkController;
|
||||
|
||||
private backgroundOperationController: OperationController;
|
||||
|
||||
private markController: MarkController;
|
||||
|
||||
private consolePorts: {[tabId: number]: browser.runtime.Port};
|
||||
|
||||
constructor() {
|
||||
this.settingController = new SettingController();
|
||||
this.commandController = new CommandController();
|
||||
this.findController = new FindController();
|
||||
this.addonEnabledController = new AddonEnabledController();
|
||||
this.linkController = new LinkController();
|
||||
this.backgroundOperationController = new OperationController();
|
||||
this.markController = new MarkController();
|
||||
|
||||
constructor(
|
||||
private settingController: SettingController,
|
||||
private commandController: CommandController,
|
||||
private findController: FindController,
|
||||
private addonEnabledController: AddonEnabledController,
|
||||
private linkController: LinkController,
|
||||
private backgroundOperationController: OperationController,
|
||||
private markController: MarkController,
|
||||
) {
|
||||
this.consolePorts = {};
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue