report/SCORM. SCORM

This class detects if JClic.js is running in an SCORM environment and, if true,
exposes the methods needed to notify the results of activities.
Both SCORM 1.2 and 2004 are supported.

Constructor

new SCORM(API, reporter)

SCORM constructor

Parameters:
NameTypeDescription
APIobject

The global SCORM API object

reportermodule:report/Reporter.Reporter

The Reporter associated to this SCORM object

Members

API :object

SCORM API object used to communicate with the LMS

Type:
  • object

core :string

Prefix used in core SCORM keys. Should be 'cmi.core.' for 1.2 and 'cmi.' for 2004

Type:
  • string

is2004 :boolean

True when the API is of type SCORM 2004, false for SCORM 1.2

Type:
  • boolean

prefix :string

Prefix to be used in SCORM function names. Should be 'LMS' for SCORM 1.2

Type:
  • string

reporter :module:report/Reporter.Reporter

The Reporter associated to this SCORM object

studentId :string

The student ID retrieved from the SCORM API

Type:
  • string

studentName :string

The student name retrieved from the SCORM API

Type:
  • string

(static) DISCOVER_MAX_TRIES :number

Maximum recursive attempts allowed to find the global SCORM API object

Type:
  • number

Methods

commit() → {boolean}

Commits current pending data to the SCORM API

Returns:
Type: 
boolean

commitInfo()

Commits the current information to the SCORM API

getScormType() → {string}

Gets the SCORM type of this SCORM object

Returns:
Type: 
string

getTimeExpression(millis) → {string}

Gets a string expression of the given time (in milliseconds) suitable for a SCORM transaction.

Parameters:
NameTypeDescription
millisnumber

The amount of time, in milliseconds

Returns:
  • An ISO8601 valid expression
Type: 
string

getValue(key) → {string}

Gets a specific value from the SCORM API

Parameters:
NameTypeDescription
keystring

A SCORM valid key

Returns:
  • The value associated with the provided key, or null if not found
Type: 
string

initialize() → {boolean}

Initializes communication with the SCORM API

Returns:
Type: 
boolean

setValue(key, value) → {string}

Sends a specific value to the SCORM API

Parameters:
NameTypeDescription
keystring

A SCORM valid key

valuestring | number

The value associated with this key

Returns:
Type: 
string

terminate() → {boolean}

Terminates communication with the SCORM API

Returns:
Type: 
boolean

(static) getSCORM(reporter) → {module:report/SCORM.SCORM}

Checks for the presence of a SCORM API on the current browser session.

Parameters:
NameTypeDescription
reportermodule:report/Reporter.Reporter

The Reporter linked to the requested SCORM object

Returns:
  • A valid SCORM object, or null if no SCORM API was found.
Type: 
module:report/SCORM.SCORM

(static) scanForAPI(win, tries) → {object}

Recursive function used to find the SCORM "API" object

Parameters:
NameTypeDescription
winobject

The 'window' object to scan for global SCORM API objects

triesnumber

Recursive attempts currently achieved

Returns:
  • The global SCORM API object, or null if not found
Type: 
object