Manage Multiple Items API Instances in a Single Page App

This example illustrates best practices for managing the lifecycle of Items API instances in a single page app. See Guidelines for Using Items API with a Single Page App Architecture for details about this approach.

In a typical single page app, views are created and destroyed frequently. If such a view contains an Items API assessments, we'll also want to create or destroy its corresponding itemsApp instance. To achieve this, we can use the LearnosityItems.init() and itemsApp.reset() methods, and integrate Items API events with our single page app.

Note that the Activity list and navigation aren't provided by Items API. They're a basic example of how a single page app might function.