make multiple calls to start() harmless

This commit is contained in:
Avraham Sakal
2023-05-16 21:12:38 -04:00
parent f205f66a75
commit 38021baf64
+7 -3
View File
@@ -66,11 +66,15 @@ export function Interpreter(machine:Machine_T, initialContext:any, initialStateN
return interpreter; return interpreter;
} }
export function start(interpreter:Interpreter_T){ export function start(interpreter:Interpreter_T){
interpreter.isPaused = false; if(interpreter.isPaused === true){
processEvents(interpreter); interpreter.isPaused = false;
processEvents(interpreter);
}
} }
export function pause(interpreter:Interpreter_T){ export function pause(interpreter:Interpreter_T){
interpreter.isPaused = true; if(interpreter.isPaused === false){
interpreter.isPaused = true;
}
} }
/** Helper function for `send()` /** Helper function for `send()`