Adrià Vilanova Martínez | 104f8ef | 2024-05-04 17:22:11 +0200 | [diff] [blame] | 1 | import Features from '../../../features/Features'; |
Adrià Vilanova Martínez | 2ba5d8d | 2024-05-04 21:17:16 +0200 | [diff] [blame] | 2 | import StandaloneScripts from '../../../scripts/Scripts'; |
| 3 | import ScriptProvider from '../scripts/ScriptProvider'; |
Adrià Vilanova Martínez | 8b591d9 | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 4 | import LegacyScriptRunner from '../scripts/LegacyScriptRunner'; |
Adrià Vilanova Martínez | 104f8ef | 2024-05-04 17:22:11 +0200 | [diff] [blame] | 5 | import { Context } from './Context'; |
| 6 | |
Adrià Vilanova Martínez | 8b591d9 | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 7 | /** |
| 8 | * @deprecated |
| 9 | */ |
Adrià Vilanova Martínez | 104f8ef | 2024-05-04 17:22:11 +0200 | [diff] [blame] | 10 | export default class EntrypointScriptRunner { |
Adrià Vilanova Martínez | 8b591d9 | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 11 | private scriptRunner: LegacyScriptRunner; |
Adrià Vilanova Martínez | 104f8ef | 2024-05-04 17:22:11 +0200 | [diff] [blame] | 12 | |
| 13 | constructor(public context: Context) { |
Adrià Vilanova Martínez | 8b591d9 | 2024-10-19 15:55:15 +0200 | [diff] [blame] | 14 | this.scriptRunner = new LegacyScriptRunner(); |
Adrià Vilanova Martínez | 2ba5d8d | 2024-05-04 21:17:16 +0200 | [diff] [blame] | 15 | this.addScriptProvider(new Features()); |
| 16 | this.addScriptProvider(new StandaloneScripts()); |
| 17 | } |
| 18 | |
| 19 | addScriptProvider(scriptProvider: ScriptProvider): EntrypointScriptRunner { |
| 20 | const scripts = scriptProvider.getScripts(this.context); |
| 21 | this.scriptRunner.add(...scripts); |
| 22 | return this; |
Adrià Vilanova Martínez | 104f8ef | 2024-05-04 17:22:11 +0200 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | run() { |
Adrià Vilanova Martínez | 104f8ef | 2024-05-04 17:22:11 +0200 | [diff] [blame] | 26 | this.scriptRunner.run(); |
| 27 | } |
| 28 | } |