blob: 4a2ed2de0931342835ebc6e360bfcda8d9b973b4 [file] [log] [blame]
import Script from './Script';
export default class ScriptRunner {
private scripts: Script[] = [];
add(...scripts: Script[]) {
this.scripts.push(...scripts);
}
run() {
this.scripts.sort((a, b) => {
if (a.priority < b.priority) return -1;
if (a.priority > b.priority) return 1;
return 0;
});
for (const script of this.scripts) {
script.execute();
}
}
}