blob: f7b3e820343dea62b66a426b6b5ee3010e24a5dc [file] [log] [blame]
Adrià Vilanova Martínezab4c80e2024-05-04 19:53:33 +02001import Script from './Script';
2
Adrià Vilanova Martínez8b591d92024-10-19 15:55:15 +02003export default class LegacyScriptRunner {
Adrià Vilanova Martínezab4c80e2024-05-04 19:53:33 +02004 private scripts: Script[] = [];
5
6 add(...scripts: Script[]) {
7 this.scripts.push(...scripts);
8 }
9
10 run() {
11 this.scripts.sort((a, b) => {
12 if (a.priority < b.priority) return -1;
13 if (a.priority > b.priority) return 1;
14 return 0;
15 });
16 for (const script of this.scripts) {
17 script.execute();
18 }
19 }
20}