From cdfd54ed99087dc4a7a3fd13865849ff9ce9e8ba Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 19 May 2019 21:34:08 +0900 Subject: Use TSyringe on background script --- .../infrastructures/ContentMessageListener.ts | 34 +++++++--------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'src/background/infrastructures/ContentMessageListener.ts') diff --git a/src/background/infrastructures/ContentMessageListener.ts b/src/background/infrastructures/ContentMessageListener.ts index 1cc2696..3d24741 100644 --- a/src/background/infrastructures/ContentMessageListener.ts +++ b/src/background/infrastructures/ContentMessageListener.ts @@ -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 = {}; } -- cgit v1.2.3