Skip to content

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

Open
@michaellenaghan

Description

@michaellenaghan

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?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions