-
Notifications
You must be signed in to change notification settings - Fork 38
How to interact with the SCORM API from the React application
This guide explains how to communicate and interact with the SCORM API from the React application developed using the RESCORM boilerplate. This guide does not explain SCORM. If you are interested in learning SCORM, you have the official documentation of SCORM 1.2 available here and the official documentation of SCORM 2004 available here.
Once the application is loaded by the web browser, it will try to find a SCORM API provided by the environment (typically a Learning Management System like Moodle). The search can have three possible results: a SCORM 2004 API is found, a SCORM 1.2 API is found, or no API is found. If an API is found, the connection will be automatically established.
Although is not necessary, since the application handles all possible failures related to the SCORM connection, it's possible for a React component to check whether the application is connected to SCORM as follows:
import * as SCORM_WRAPPER from '../vendors/SCORM_API_Wrapper.js';
[...]
if(SCORM_WRAPPER.isConnected()){
//The app is connected to a SCORM-compliant environment.
} else {
//The app is not connected.
}