In order to improve code readability in quite common cases, it was decided to make scenario thennable, so that instead of assigning scenario to a variable and then awaiting a final event, like this:
const drawingScenario = scenario(
draw.events.invoked,
stopDrawing.events.invoked,
({ arguments: [endPoint] }) => {
currentLineLayerState.set((layer) => ({ ...layer, endPoint }));
},
);
await drawingScenario.events.expired;
it should be possible to do it like this:
await scenario(
draw.events.invoked,
stopDrawing.events.invoked,
({ arguments: [endPoint] }) => {
currentLineLayerState.set((layer) => ({ ...layer, endPoint }));
},
);
It should also warn a user if he is trying to await and infinite scenario.