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