Rubric Editor API Events
practice:change
Fires whenever the Test panel data changes.
You would want to be notified about this event firing to track changes to the Test panel data. This could be useful, for example, if you wanted to persist the data in your own application, or implement custom error handling for practice scoring.
This event will fire for any change to the data returned by the getPractice() method, including changes to responses, scoring results, and session state.
Examples
rubricEditor.on('practice:change', function (practice) {
// Log the Test panel data whenever it changes
console.log('Test panel data has changed', practice);
// Check whether the access token limit has been exhausted
if (practice.sessionState.isExhausted) {
console.log('The access token limit has been exhausted.');
}
});
Callback arguments
-
practice object
The current Test panel data object, containing the stimulus, sources, responses, and session state. See the
getPractice()method for the full structure of this object.
Caveats
- This event does not fire during initialization. Data passed at init or seeded on attach does not produce an event.
- Calling the
setPractice()method will re-trigger this event. If you are restoring persisted state on load, be careful to avoid creating an infinite loop where the event handler callssetPractice()again.
Related articles
- The
getPractice()method, which returns the current Test panel data. - The
setPractice()method, which sets values for the Test panel.