statecharts / statecharts.github.io

There is no state but what we make. Feel free to pitch in.
https://statecharts.dev/
311 stars 51 forks source link

Confusing point on the `use-case-statecharts-in-user-interfaces.md` page #45

Open michaellenaghan opened 4 years ago

michaellenaghan commented 4 years ago

The page has this snippet:

green: {
  onEntry: "startHttpRequest",
  onExit: "cancelHttpRequest",
  ...
}

followed shortly thereafter by this snippet:

function transition(event, data) {
  currentState = stateMachine.transition(currentState, event, data);
  field.classList.value = currentState.value;
  currentState.actions.forEach(item => window[item]());
}

There's no explanation of how onEntry and onExit get mapped to actions. (I think I worked it out but it seems like it would be worth spelling it out explicitly for the reader?)

mogsie commented 4 years ago

Yeah, thanks for this reminder. The page has quite a few TKTK markers so it's not quite finished, and the end does leave the reader hanging. I'll try to find some time to finish this page.