This is a lower-level API. Lower-level APIs are not recommended for most projects, and may not be available on all plans. See our page on recommended deployment patterns for more information.
Event Assess API

item:beforeunload

Fires when the selected Item is about to be deactivated. This will be fired before the item:unload event.

You would want to be notified about this event firing so that you can, for example, gracefully control the current learner's ability to navigate to the next Item.

Note If preventDefault is called, the current Item will not be unloaded and other events like item:unload will not be fired.

Examples

itemsApp.on('item:beforeunload', function (event) {
    console.log('This code executes when an Item is about to become deactivated.');
});

Callback arguments

  • event object
    An object containing the preventDefault method that can be used to prevent the current Item from being unloaded.

Related articles

  • The item:load event, the event that occurs when an Item has been loaded, rendered and is ready for the learner to interact.
Was this article helpful?