SCORM
Source: SCORM.js:40
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: object,
reporter: module:report/Reporter.Reporter,
): SCORMSCORM constructor
Parameters
API(object) — The global SCORM API objectreporter(module:report/Reporter.Reporter) — TheReporterassociated to this SCORM object
Instance Methods
initialize(): boolean
Initializes communication with the SCORM API
Returns
boolean
terminate(): boolean
Terminates communication with the SCORM API
Returns
boolean
commitInfo()
Commits the current information to the SCORM API
commit(): boolean
Commits current pending data to the SCORM API
Returns
boolean
setValue(key: string, value: string | number): string
Sends a specific value to the SCORM API
Parameters
key(string) — A SCORM valid keyvalue(string | number) — The value associated with this key
Returns
string
getValue(key: string): string
Gets a specific value from the SCORM API
Parameters
key(string) — A SCORM valid key
Returns
string
getTimeExpression(millis: number): string
Gets a string expression of the given time (in milliseconds) suitable for a SCORM transaction.
Parameters
millis(number) — The amount of time, in milliseconds
Returns
string
getScormType(): string
Gets the SCORM type of this SCORM object
Returns
string
Static Methods
scanForAPI(win: object, tries: number): object
Recursive function used to find the SCORM "API" object
Parameters
win(object) — The 'window' object to scan for global SCORM API objectstries(number) — Recursive attempts currently achieved
Returns
object
getSCORM(
reporter: module:report/Reporter.Reporter,
): module:report/SCORM.SCORM
Checks for the presence of a SCORM API on the current browser session.
Parameters
reporter(module:report/Reporter.Reporter) — TheReporterlinked to the requested SCORM object
Returns
Instance Fields
is2004: boolean
True when the API is of type SCORM 2004, false for SCORM 1.2
reporter: module:report/Reporter.Reporter
The Reporter associated to this SCORM object
prefix: string
Prefix to be used in SCORM function names. Should be 'LMS' for SCORM 1.2
core: string
Prefix used in core SCORM keys. Should be 'cmi.core.' for 1.2 and 'cmi.' for 2004
API: object
SCORM API object used to communicate with the LMS
studentId: string
The student ID retrieved from the SCORM API
studentName: string
The student name retrieved from the SCORM API
Static Fields
DISCOVER_MAX_TRIES: number
Maximum recursive attempts allowed to find the global SCORM API object