Consume learning events

Algebrakit's web components emit events to notify your system of key moments in the student learning process. These events cover:

  • Lifecycle events (e.g. component creation and activation)
  • Student actions (e.g. submitting an answer, requesting a hint)
  • Completion, at interaction, question and exercise level

Use them to drive your own UI: enable a "next" button when an exercise finishes, show your own hint button only when a hint is available, or record progress as the student works.

Subscribing

Listen for learning events globally or for a specific session with addExerciseListener().

AlgebraKIT.addExerciseListener((eventData) => {
  // handle event
});

// listen to events related to a session
AlgebraKIT.addExerciseListener("my-session-id", (eventData) => {
  // handle session-specific event
});

Every payload carries the event name and the sessionId it belongs to, so a single global listener can serve a page with several exercises on it.

Which event do I need?

If you want to Listen for
Know an exercise is on screen and ready exercise-created
Enable or disable your own hint button interaction-hint-state-changed
React to a submitted answer interaction-evaluate
Know a question is complete question-finished
Know the whole exercise is complete exercise-finished

Scoring

Scoring information arrives with the evaluation and completion events, but those payloads are for driving your UI. Treat the session score endpoint as the authoritative record: it is served from Algebrakit's own store and cannot be tampered with in the browser.

Every event, its payload and the full list of exposed functions are in the learning events reference.