Adrià Vilanova MartÃnez | 58cc67c | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 1 | import DependenciesProviderSingleton, { |
| 2 | AutoRefreshDependency, |
| 3 | } from '../../../common/architecture/dependenciesProvider/DependenciesProvider'; |
| 4 | import { |
| 5 | ScriptEnvironment, |
| 6 | ScriptPage, |
| 7 | ScriptRunPhase, |
| 8 | } from '../../../common/architecture/scripts/Script'; |
| 9 | import NodeWatcherScript from '../../../common/architecture/scripts/nodeWatcher/NodeWatcherScript'; |
| 10 | import AutoRefresh from '../core/autoRefresh'; |
| 11 | import AutoRefreshThreadListHideHandler from '../nodeWatcherHandlers/threadListHide.handler'; |
| 12 | import AutoRefreshThreadListSetUpHandler from '../nodeWatcherHandlers/threadListSetUp.handler'; |
| 13 | |
| 14 | export interface AutoRefreshNodeWatcherDependencies { |
| 15 | autoRefresh: AutoRefresh; |
| 16 | } |
| 17 | |
| 18 | export default class AutoRefreshNodeWatcherScript extends NodeWatcherScript<AutoRefreshNodeWatcherDependencies> { |
| 19 | public page = ScriptPage.CommunityConsole; |
| 20 | public environment = ScriptEnvironment.ContentScript; |
| 21 | public runPhase = ScriptRunPhase.Main; |
| 22 | public handlers = new Map([ |
| 23 | ['autoRefreshThreadListSetUp', AutoRefreshThreadListSetUpHandler], |
| 24 | ['autoRefreshThreadListHide', AutoRefreshThreadListHideHandler], |
| 25 | ]); |
| 26 | |
| 27 | protected optionsFactory(): AutoRefreshNodeWatcherDependencies { |
| 28 | const dependenciesProvider = DependenciesProviderSingleton.getInstance(); |
| 29 | return { |
| 30 | autoRefresh: dependenciesProvider.getDependency(AutoRefreshDependency), |
| 31 | }; |
| 32 | } |
| 33 | } |