@szenadam/scorm-api-wrapper
Version:
SCORM API Wrapper
140 lines (139 loc) • 4.44 kB
TypeScript
declare class ScormApiWrapper {
/**
* The API (SCORM 1.2) or API_1484_11 (SCORM 2004) object which contains the SCORM Runtime API.
*/
apiHandle: any;
/**
* The SCORM Runtime version.
*/
scormVersion: string;
/**
* Turn on/off logging in trace().
*/
debugModeEnabled: boolean;
/**
* Should the wrapper handle completion status when running initialize().
*/
handleCompletionStatus: boolean;
/**
* Should the wrapper handle exit mode when running terminate().
*/
handleExitMode: boolean;
/**
* True is the wrapper did find the SCORM Runtime API.
*/
apiIsFound: boolean;
/**
* Is the connection is active or not.
*/
connectionIsActive: boolean;
/**
* Completion status value.
*/
dataCompletionStatus: any;
/**
* Exit mode value.
*/
dataExitStatus: any;
constructor(debug: boolean);
/**
* Tells the LMS to initiate the communication session.
*/
initialize(): boolean;
/**
* Tells the LMS to terminate the communication session.
*/
terminate(): boolean;
/**
* A simple function to allow Flash ExternalInterface to confirm
* presence of JS wrapper before attempting any LMS communication.
*/
isAvailable(): boolean;
/**
* Looks for an object named API (SCORM 1.2) or API_1483_11 (SCORM 2004) in parent and opener windows.
*
* @param win the window object
*/
findApi(win: any): any;
/**
* Looks for an object named API (SCORM 1.2) or API_1483_11 (SCORM 2004), first in the current window's frame
* hierarchy and then, if necessary, in the current window's opener window
* hierarchy (if there is an opener window).
*/
getApi(): any;
/**
* Returns the handle to API (SCORM 1.2) or API_1483_11 (SCORM 2004) object if it was previously set.
*/
getApiHandle(): any;
/**
* Requests the error code for the current error state from the LMS.
*/
getCode(): number;
/**
* Requests information from the LMS.
*
* Side effects:
* - Sets the class property dataCompletionStatus when "cmi.core.lesson_status" (SCORM 1.2) or "cmi.completion_status"
* (SCORM 2004) is requested.
* - Also sets class property dataExitStatus when "cmi.core.exit" (SCORM 1.2) or "cmi.exit"
* (SCORM 2004) is requested.
*
* @param {string} parameter parameter name of the SCORM data model element
*/
dataGet(parameter: string): string;
/**
* Tells the LMS to assign the value to the named data model element.
* Also stores the SCO's completion status in a variable named
* ScormApiWrapper.completionStatus. This variable is checked whenever
* ScormApiWrapper.terminate() is invoked.
*
* @param parameter {string} The data model element
* @param value {string} The value for the data model element
*/
dataSet(parameter: string, value: string): boolean;
/**
* Get completion status value.
*
* @returns Current completion status value.
*/
getStatus(): string;
/**
* Set completion status.
*
* @param status completion status we want to set.
* @returns
*/
setStatus(status: string): boolean;
/**
* Instructs the LMS to persist all data to this point in the session.
*/
save(): boolean;
/**
* Displays error messages when in debug mode.
*
* @param msg message to be displayed
*/
trace(msg: string): void;
/**
* "Used by a SCO to request the textual description for the error code
* specified by the value of [errorCode]."
*
* @param errorCode {number}
*/
getInfo(errorCode: number): string;
/**
* "Exists for LMS specific use. It allows the LMS to define additional
* diagnostic information through the API Instance."
*
* @param {number} errorCode
*/
getDiagnosticInfo(errorCode: number): string;
/**
* Converts 'boolean strings' into actual valid booleans.
* (Most values returned from the API are the strings "true" and "false".)
*
* @param value
*/
stringToBoolean(value: any): boolean;
}
export default ScormApiWrapper;