JSAV supports AVs to log student actions into an event log. It also provides mechanisms for sites using the AVs to access a log of those events.
AVs can log events on student actions using this function. The eventData
can
be any data describing the event. If it is an object, properties tstamp
and
av
will be automatically added to it to mark the current time and the ID of
the AV.
For example:
JSAV will trigger all events logged with the .logEvent()
function as
jsav-log-event
on the body
element of the current document. To
attach a listener for those events, one can use the following code.
JSAV will automatically trigger many events for actions such as student moving forward, backward, etc in the animation.
Sometimes listening to the events on the body
element might not be preferred.
To customize the way the events are handler, a function to handle all JSAV events can be
passed as an option to JSAV when initializing it. Name of the option is logEvent
.
The event handler function will be passed the eventData
as the first argument.
For example: