Assert current state is one of allowed states; throw with detail on violation.
(allowed: readonly AppRuntimeState[], detail: string)
| 44 | |
| 45 | /** Assert current state is one of allowed states; throw with detail on violation. */ |
| 46 | assertOneOf(allowed: readonly AppRuntimeState[], detail: string): void { |
| 47 | for (const s of allowed) { |
| 48 | if (this.state0 === s) return; |
| 49 | } |
| 50 | invalidState(detail); |
| 51 | } |
| 52 | |
| 53 | /** Transition to Running; valid from Created or Stopped. */ |
| 54 | toRunning(): void { |
no test coverage detected