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?
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 DOMpreventDefault()
can be called in case the event is handled, and not callpreventDefault()
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?