Event Overview
The edML player triggers JavaScript events during various processing operations. These events are always "dispatched" from the DOM object in which the player is located. This DOM object can also be easily identified in the DOM tree by the attached edmlplayer class, e.g. using:
Using a "JavaScript listener", these events can be monitored and handled accordingly. In the following example, the "listener" is added and an alert is triggered using an anonymous function:
var edmlnode = document.querySelector('.edmlplayer');
edmlnode.addEventListner('edmlevent',function(evt){
alert("The event has occurred!");
});
- edmlevent-changelanguage
- edmlevent-coursestarted
- edmlevent-error
- edmlevent-newpage
Note: The DOM object in which the edML player is running can also be obtained using the getOutput() method of the edML player object.