SCION icon indicating copy to clipboard operation
SCION copied to clipboard

Know if event is handled by state machine or not

Open mogsie opened this issue 9 years ago • 0 comments

When gen() is called, it returns the basic configuration of the state machine after processing the event. But sometimes the event is (correctly) ignored by the state machine. It is sometimes useful to detect these situations, e.g. so that DOM preventDefault() can be called in case the event is handled, and not call preventDefault() if the state machine didn't handle the event.

Imagine a situation where certain keystrokes are fed to the state machine (e.g. up, down, left, right) and that we want to prevent the default propagation of the keystroke event if and only if the state machine handled the event. I don't want to have to litter calls to e.preventDefault() events in the SCXML, as the SCXML is decoupled from the DOM itself, and introducing a dependency is unnecessary and ugly.

I was thinking that the response to gen could be null in the case where the event was not handled. It would probably break backward compatibility so it's not a feasible solution.

Is this at all interesting for other applications?

mogsie avatar May 27 '15 22:05 mogsie