scorm-again
Version:
A modern SCORM JavaScript run-time library for SCORM 1.2 and SCORM 2004
80 lines • 5.09 kB
TypeScript
import { StringKeyMap } from "./utilities";
import { BaseCMI } from "./cmi/common/base_cmi";
import { ErrorCode } from "./constants";
import { CommitObject, InternalSettings, LogLevel, ResultObject, Settings } from "./types";
import { IBaseAPI, ICMIDataService, IErrorHandlingService, IEventService, IHttpService, ILoggingService, IOfflineStorageService, ISerializationService, ScormEventCallback } from "./interfaces";
export default abstract class BaseAPI implements IBaseAPI {
private _timeout?;
protected readonly _error_codes: ErrorCode;
private _settings;
private readonly _httpService;
private _eventService;
private _serializationService;
private readonly _errorHandlingService;
private readonly _loggingService;
private readonly _offlineStorageService?;
private readonly _cmiValueAccessService;
private _courseId;
protected constructor(error_codes: ErrorCode, settings?: Settings, httpService?: IHttpService, eventService?: IEventService, serializationService?: ISerializationService, cmiDataService?: ICMIDataService, errorHandlingService?: IErrorHandlingService, loggingService?: ILoggingService, offlineStorageService?: IOfflineStorageService);
abstract cmi: BaseCMI;
startingData?: StringKeyMap;
currentState: number;
get lastErrorCode(): string;
set lastErrorCode(errorCode: string);
protected get eventService(): IEventService;
protected get loggingService(): ILoggingService;
abstract reset(settings?: Settings): void;
commonReset(settings?: Settings): void;
initialize(callbackName: string, initializeMessage?: string, terminationMessage?: string): string;
abstract lmsInitialize(parameter?: string): string;
abstract lmsFinish(parameter?: string): string;
abstract lmsGetValue(CMIElement: string): string;
abstract lmsSetValue(CMIElement: string, value: any): string;
abstract lmsCommit(parameter?: string): string;
abstract lmsGetLastError(): string;
abstract lmsGetErrorString(CMIErrorCode: string | number): string;
abstract lmsGetDiagnostic(CMIErrorCode: string | number): string;
abstract validateCorrectResponse(_CMIElement: string, _value: any): void;
abstract getChildElement(_CMIElement: string, _value: any, _foundFirstIndex: boolean): BaseCMI | null;
abstract storeData(_calculateTotalTime: boolean): ResultObject;
abstract renderCommitCMI(_terminateCommit: boolean, _includeTotalTime?: boolean): StringKeyMap | Array<string>;
abstract renderCommitObject(_terminateCommit: boolean, _includeTotalTime?: boolean): CommitObject;
apiLog(functionName: string, logMessage: string, messageLevel: LogLevel, CMIElement?: string): void;
get settings(): InternalSettings;
set settings(settings: Settings);
terminate(callbackName: string, checkTerminated: boolean): string;
getValue(callbackName: string, checkTerminated: boolean, CMIElement: string): string;
setValue(callbackName: string, commitCallback: string, checkTerminated: boolean, CMIElement: string, value: any): string;
commit(callbackName: string, checkTerminated?: boolean): string;
getLastError(callbackName: string): string;
getErrorString(callbackName: string, CMIErrorCode: string | number): string;
getDiagnostic(callbackName: string, CMIErrorCode: string | number): string;
checkState(checkTerminated: boolean, beforeInitError: number, afterTermError: number): boolean;
protected _checkForDuplicateId(CMIElement: string, value: string): boolean;
getLmsErrorMessageDetails(_errorNumber: string | number, _detail?: boolean): string;
getCMIValue(_CMIElement: string): string;
setCMIValue(_CMIElement: string, _value: any): string;
_commonSetCMIValue(methodName: string, scorm2004: boolean, CMIElement: string, value: any): string;
_commonGetCMIValue(methodName: string, scorm2004: boolean, CMIElement: string): any;
isInitialized(): boolean;
isNotInitialized(): boolean;
isTerminated(): boolean;
on(listenerName: string, callback: ScormEventCallback): void;
off(listenerName: string, callback: ScormEventCallback): void;
clear(listenerName: string): void;
processListeners(functionName: string, CMIElement?: string, value?: any): void;
throwSCORMError(CMIElement: string | undefined, errorNumber: number | undefined, message?: string): void;
clearSCORMError(success: string): void;
loadFromFlattenedJSON(json: StringKeyMap, CMIElement?: string): void;
getFlattenedCMI(): StringKeyMap;
loadFromJSON(json: StringKeyMap, CMIElement?: string): void;
renderCMIToJSONString(): string;
renderCMIToJSONObject(): StringKeyMap;
processHttpRequest(url: string, params: CommitObject | StringKeyMap | Array<any>, immediate?: boolean): ResultObject;
scheduleCommit(when: number, callback: string): void;
clearScheduledCommit(): void;
private _checkObjectHasProperty;
private handleValueAccessException;
protected getCommitObject(terminateCommit: boolean): CommitObject | StringKeyMap | Array<any>;
}
//# sourceMappingURL=BaseAPI.d.ts.map