// assume LViS Event exists and is set as active
var event = LViS.getEvent();
var handleState = function (state) {
// Do something when you receive a new Element
// Triggered when a new Element is triggered
event.on(LViS.Event.ON_ELEMENT_PUBLISH, function (element) {
switch (element.getContentType()) {
// Listen to the quiz Element's state change
quiz.bind(LViS.Quiz.ON_STATE_CHANGE, handleState);
// Force handling of the quiz's current state
handleState(quiz.getState());