By default, the Items API will load all of the content needed for an assessment in one request. For assessments with many Items, this loading and rendering process can take some time to complete. When rendering the user interface of the Items API, for example, this can cause a noticeable delay before the "Start" button appears, and this delay can vary depending on the number and complexity of Items in the assessment.
To mitigate this problem, you can use an alternative initialization option known as "lazy rendering". In this mode, Items will be rendered in batches making it possible to begin the assessment while other Items continue to render in the background.
Lazy rendering can be switched on by setting the lazyload
Init option to true, and then you can listen to the following events to keep track of lazy rendering operations:
- items.lazyload.batch - Fires when a new batch of Items have been loaded,
- items.lazyload.complete - Fires when all Items have been loaded successfully, and
- items.lazyload.error - Fires when an error occurs during the Item batch loading process.
Note: Batch loading is optimized based on user experience. When initializing new sessions, the first batch of Items to load will begin with Item one. When resuming a session, the first batch of Items to load will begin with the last Item seen by the user. Also, when navigating before loading is complete, there can be a short delay if the desired Item hasn't yet loaded.