Inital Commit

This commit is contained in:
root
2025-06-24 15:43:32 +02:00
commit 23341b8abb
4657 changed files with 549083 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateMachine = void 0;
const allowedTransitions = {
'stopped': ['stopped', 'idle', 'destroyed'],
'idle': ['idle', 'running', 'stopped', 'destroyed'],
'running': ['running', 'idle', 'stopped', 'destroyed'],
'destroyed': ['destroyed']
};
class StateMachine {
state;
constructor(initial = 'stopped') {
this.state = initial;
}
changeState(state) {
if (allowedTransitions[this.state].includes(state)) {
this.state = state;
}
else {
throw new Error(`invalid transition from ${this.state} to ${state}`);
}
}
}
exports.StateMachine = StateMachine;
//# sourceMappingURL=state-machine.js.map