blob: 76f5990f6e7bd7359afa209dfef492b544399d7f [file] [log] [blame]
Adrià Vilanova Martínezb523be92024-05-25 19:14:19 +02001import { OptionCodename } from '../../options/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}