blob: c14c33840fd98bce06640853947deee84e7a0c80 [file] [log] [blame]
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02001import Script, { ConcreteScript } from '../scripts/Script';
2
3export default abstract class Feature {
4 /**
5 * Internal codename used for the feature.
6 *
7 * It will be used for i18n translations, shown in log messages, etc.
8 */
9 abstract readonly codename: string;
10
11 /**
12 * Options which control the behavior of this feature.
13 */
14 abstract readonly relatedOptions: string[];
15
16 /**
17 * Uninitialized scripts which are associated with the feature.
18 */
19 abstract readonly scripts: ConcreteScript[];
20
21 private initializedScripts: Script[];
22
23 public getScripts() {
24 if (this.initializedScripts === undefined) {
25 this.initializedScripts = this.scripts.map((script) => new script());
26 }
27 return this.initializedScripts;
28 }
29}