scorm-again 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -23
- package/dist/aicc.js +65 -41
- package/dist/aicc.js.map +1 -1
- package/dist/aicc.min.js +1 -1
- package/dist/aicc.min.js.map +1 -1
- package/dist/esm/aicc.js +65 -41
- package/dist/esm/aicc.js.map +1 -1
- package/dist/esm/aicc.min.js +1 -1
- package/dist/esm/aicc.min.js.map +1 -1
- package/dist/esm/scorm-again.js +78 -48
- package/dist/esm/scorm-again.js.map +1 -1
- package/dist/esm/scorm-again.min.js +1 -1
- package/dist/esm/scorm-again.min.js.map +1 -1
- package/dist/esm/scorm12.js +65 -41
- package/dist/esm/scorm12.js.map +1 -1
- package/dist/esm/scorm12.min.js +1 -1
- package/dist/esm/scorm12.min.js.map +1 -1
- package/dist/esm/scorm2004.js +78 -48
- package/dist/esm/scorm2004.js.map +1 -1
- package/dist/esm/scorm2004.min.js +1 -1
- package/dist/esm/scorm2004.min.js.map +1 -1
- package/dist/scorm-again.js +78 -48
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +1 -1
- package/dist/scorm-again.min.js.map +1 -1
- package/dist/scorm12.js +65 -41
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +1 -1
- package/dist/scorm12.min.js.map +1 -1
- package/dist/scorm2004.js +78 -48
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -1
- package/package.json +4 -4
- package/src/AICC.ts +2 -2
- package/src/BaseAPI.ts +28 -66
- package/src/Scorm12API.ts +3 -3
- package/src/Scorm2004API.ts +11 -7
- package/src/cmi/aicc/attempts.ts +7 -7
- package/src/cmi/aicc/cmi.ts +4 -4
- package/src/cmi/aicc/core.ts +1 -1
- package/src/cmi/aicc/evaluation.ts +1 -1
- package/src/cmi/aicc/student_data.ts +2 -2
- package/src/cmi/aicc/student_preferences.ts +2 -2
- package/src/cmi/aicc/tries.ts +7 -7
- package/src/cmi/scorm12/cmi.ts +1 -1
- package/src/cmi/scorm12/interactions.ts +1 -1
- package/src/cmi/scorm2004/adl.ts +2 -2
- package/src/cmi/scorm2004/cmi.ts +1 -1
- package/src/cmi/scorm2004/interactions.ts +1 -1
- package/src/cmi/scorm2004/objectives.ts +1 -1
- package/src/cmi/scorm2004/score.ts +1 -1
- package/src/constants/api_constants.ts +0 -10
- package/src/constants/default_settings.ts +25 -8
- package/src/constants/enums.ts +9 -0
- package/src/constants/regex.ts +1 -1
- package/src/exceptions.ts +1 -5
- package/src/types/api_types.ts +26 -3
- package/test/Scorm12API.spec.ts +101 -1
- package/test/types/api_types.spec.ts +38 -45
- package/tsconfig.json +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scorm-again",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
|
|
5
5
|
"main": "dist/scorm-again.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"jsdoc-babel": "^0.5.0",
|
|
53
53
|
"minimist": "^1.2.8",
|
|
54
54
|
"miragejs": "^0.2.0-alpha.3",
|
|
55
|
-
"mocha": "^10.
|
|
55
|
+
"mocha": "^10.8.2",
|
|
56
56
|
"mocha-junit-reporter": "^2.2.1",
|
|
57
57
|
"mochawesome": "^7.1.3",
|
|
58
58
|
"prettier": "^3.3.3",
|
|
59
59
|
"sinon": "^19.0.2",
|
|
60
60
|
"terser-webpack-plugin": "^5.3.10",
|
|
61
61
|
"ts-loader": "^9.5.1",
|
|
62
|
-
"tsx": "^4.19.
|
|
62
|
+
"tsx": "^4.19.2",
|
|
63
63
|
"typescript": "^5.6.3",
|
|
64
|
-
"typescript-eslint": "^8.
|
|
64
|
+
"typescript-eslint": "^8.12.2",
|
|
65
65
|
"webpack": "^5.91.0",
|
|
66
66
|
"webpack-cli": "^5.1.4"
|
|
67
67
|
},
|
package/src/AICC.ts
CHANGED
|
@@ -33,7 +33,7 @@ class AICCImpl extends Scorm12Impl {
|
|
|
33
33
|
* @param {boolean} foundFirstIndex
|
|
34
34
|
* @return {BaseCMI | null}
|
|
35
35
|
*/
|
|
36
|
-
getChildElement(
|
|
36
|
+
override getChildElement(
|
|
37
37
|
CMIElement: string,
|
|
38
38
|
value: any,
|
|
39
39
|
foundFirstIndex: boolean,
|
|
@@ -64,7 +64,7 @@ class AICCImpl extends Scorm12Impl {
|
|
|
64
64
|
*
|
|
65
65
|
* @param {AICCImpl} newAPI
|
|
66
66
|
*/
|
|
67
|
-
replaceWithAnotherScormAPI(newAPI: AICCImpl) {
|
|
67
|
+
override replaceWithAnotherScormAPI(newAPI: AICCImpl) {
|
|
68
68
|
// Data Model
|
|
69
69
|
this.cmi = newAPI.cmi;
|
|
70
70
|
this.nav = newAPI.nav;
|
package/src/BaseAPI.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { formatMessage, stringMatches, unflatten } from "./utilities";
|
|
|
6
6
|
import { BaseCMI } from "./cmi/common/base_cmi";
|
|
7
7
|
import {
|
|
8
8
|
CommitObject,
|
|
9
|
+
LogLevel,
|
|
9
10
|
RefObject,
|
|
10
11
|
ResultObject,
|
|
11
12
|
Settings,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
import { DefaultSettings } from "./constants/default_settings";
|
|
14
15
|
import { IBaseAPI } from "./interfaces/IBaseAPI";
|
|
15
16
|
import { ScheduledCommit } from "./helpers/scheduled_commit";
|
|
17
|
+
import { LogLevelEnum } from "./constants/enums";
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* Base API class for AICC, SCORM 1.2, and SCORM 2004. Should be considered
|
|
@@ -44,6 +46,10 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
44
46
|
}
|
|
45
47
|
this.apiLogLevel = this.settings.logLevel;
|
|
46
48
|
this.selfReportSessionTime = this.settings.selfReportSessionTime;
|
|
49
|
+
|
|
50
|
+
if (this.apiLogLevel === undefined) {
|
|
51
|
+
this.apiLogLevel = LogLevelEnum.NONE;
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
public abstract cmi: BaseCMI;
|
|
@@ -52,7 +58,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
52
58
|
public currentState: number;
|
|
53
59
|
public lastErrorCode: string;
|
|
54
60
|
public listenerArray: any[];
|
|
55
|
-
public apiLogLevel:
|
|
61
|
+
public apiLogLevel: LogLevel;
|
|
56
62
|
public selfReportSessionTime: boolean;
|
|
57
63
|
|
|
58
64
|
abstract reset(settings?: Settings): void;
|
|
@@ -99,11 +105,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
99
105
|
this.processListeners(callbackName);
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
this.apiLog(
|
|
103
|
-
callbackName,
|
|
104
|
-
"returned: " + returnValue,
|
|
105
|
-
APIConstants.global.LOG_LEVEL_INFO,
|
|
106
|
-
);
|
|
108
|
+
this.apiLog(callbackName, "returned: " + returnValue, LogLevelEnum.INFO);
|
|
107
109
|
this.clearSCORMError(returnValue);
|
|
108
110
|
|
|
109
111
|
return returnValue;
|
|
@@ -187,7 +189,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
187
189
|
apiLog(
|
|
188
190
|
functionName: string,
|
|
189
191
|
logMessage: string,
|
|
190
|
-
messageLevel:
|
|
192
|
+
messageLevel: LogLevel,
|
|
191
193
|
CMIElement?: string,
|
|
192
194
|
) {
|
|
193
195
|
logMessage = formatMessage(functionName, logMessage, CMIElement);
|
|
@@ -257,11 +259,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
257
259
|
this.processListeners(callbackName);
|
|
258
260
|
}
|
|
259
261
|
|
|
260
|
-
this.apiLog(
|
|
261
|
-
callbackName,
|
|
262
|
-
"returned: " + returnValue,
|
|
263
|
-
APIConstants.global.LOG_LEVEL_INFO,
|
|
264
|
-
);
|
|
262
|
+
this.apiLog(callbackName, "returned: " + returnValue, LogLevelEnum.INFO);
|
|
265
263
|
this.clearSCORMError(returnValue);
|
|
266
264
|
|
|
267
265
|
return returnValue;
|
|
@@ -301,7 +299,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
301
299
|
this.apiLog(
|
|
302
300
|
callbackName,
|
|
303
301
|
": returned: " + returnValue,
|
|
304
|
-
|
|
302
|
+
LogLevelEnum.INFO,
|
|
305
303
|
CMIElement,
|
|
306
304
|
);
|
|
307
305
|
|
|
@@ -370,7 +368,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
370
368
|
this.apiLog(
|
|
371
369
|
callbackName,
|
|
372
370
|
": " + value + ": result: " + returnValue,
|
|
373
|
-
|
|
371
|
+
LogLevelEnum.INFO,
|
|
374
372
|
CMIElement,
|
|
375
373
|
);
|
|
376
374
|
this.clearSCORMError(returnValue);
|
|
@@ -388,7 +386,6 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
388
386
|
callbackName: string,
|
|
389
387
|
checkTerminated: boolean = false,
|
|
390
388
|
): Promise<string> {
|
|
391
|
-
console.log("commit");
|
|
392
389
|
this.clearScheduledCommit();
|
|
393
390
|
|
|
394
391
|
let returnValue = APIConstants.global.SCORM_FALSE;
|
|
@@ -412,7 +409,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
412
409
|
this.apiLog(
|
|
413
410
|
callbackName,
|
|
414
411
|
" Result: " + returnValue,
|
|
415
|
-
|
|
412
|
+
LogLevelEnum.DEBUG,
|
|
416
413
|
"HttpRequest",
|
|
417
414
|
);
|
|
418
415
|
|
|
@@ -421,11 +418,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
421
418
|
this.processListeners(callbackName);
|
|
422
419
|
}
|
|
423
420
|
|
|
424
|
-
this.apiLog(
|
|
425
|
-
callbackName,
|
|
426
|
-
"returned: " + returnValue,
|
|
427
|
-
APIConstants.global.LOG_LEVEL_INFO,
|
|
428
|
-
);
|
|
421
|
+
this.apiLog(callbackName, "returned: " + returnValue, LogLevelEnum.INFO);
|
|
429
422
|
this.clearSCORMError(returnValue);
|
|
430
423
|
|
|
431
424
|
return returnValue;
|
|
@@ -441,11 +434,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
441
434
|
|
|
442
435
|
this.processListeners(callbackName);
|
|
443
436
|
|
|
444
|
-
this.apiLog(
|
|
445
|
-
callbackName,
|
|
446
|
-
"returned: " + returnValue,
|
|
447
|
-
APIConstants.global.LOG_LEVEL_INFO,
|
|
448
|
-
);
|
|
437
|
+
this.apiLog(callbackName, "returned: " + returnValue, LogLevelEnum.INFO);
|
|
449
438
|
|
|
450
439
|
return returnValue;
|
|
451
440
|
}
|
|
@@ -465,11 +454,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
465
454
|
this.processListeners(callbackName);
|
|
466
455
|
}
|
|
467
456
|
|
|
468
|
-
this.apiLog(
|
|
469
|
-
callbackName,
|
|
470
|
-
"returned: " + returnValue,
|
|
471
|
-
APIConstants.global.LOG_LEVEL_INFO,
|
|
472
|
-
);
|
|
457
|
+
this.apiLog(callbackName, "returned: " + returnValue, LogLevelEnum.INFO);
|
|
473
458
|
|
|
474
459
|
return returnValue;
|
|
475
460
|
}
|
|
@@ -489,11 +474,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
489
474
|
this.processListeners(callbackName);
|
|
490
475
|
}
|
|
491
476
|
|
|
492
|
-
this.apiLog(
|
|
493
|
-
callbackName,
|
|
494
|
-
"returned: " + returnValue,
|
|
495
|
-
APIConstants.global.LOG_LEVEL_INFO,
|
|
496
|
-
);
|
|
477
|
+
this.apiLog(callbackName, "returned: " + returnValue, LogLevelEnum.INFO);
|
|
497
478
|
|
|
498
479
|
return returnValue;
|
|
499
480
|
}
|
|
@@ -668,7 +649,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
668
649
|
this.apiLog(
|
|
669
650
|
methodName,
|
|
670
651
|
`There was an error setting the value for: ${CMIElement}, value of: ${value}`,
|
|
671
|
-
|
|
652
|
+
LogLevelEnum.WARN,
|
|
672
653
|
);
|
|
673
654
|
}
|
|
674
655
|
|
|
@@ -827,7 +808,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
827
808
|
this.apiLog(
|
|
828
809
|
"on",
|
|
829
810
|
`Added event listener: ${this.listenerArray.length}`,
|
|
830
|
-
|
|
811
|
+
LogLevelEnum.INFO,
|
|
831
812
|
functionName,
|
|
832
813
|
);
|
|
833
814
|
}
|
|
@@ -865,7 +846,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
865
846
|
this.apiLog(
|
|
866
847
|
"off",
|
|
867
848
|
`Removed event listener: ${this.listenerArray.length}`,
|
|
868
|
-
|
|
849
|
+
LogLevelEnum.INFO,
|
|
869
850
|
functionName,
|
|
870
851
|
);
|
|
871
852
|
}
|
|
@@ -905,12 +886,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
905
886
|
* @param {any} value
|
|
906
887
|
*/
|
|
907
888
|
processListeners(functionName: string, CMIElement?: string, value?: any) {
|
|
908
|
-
this.apiLog(
|
|
909
|
-
functionName,
|
|
910
|
-
value,
|
|
911
|
-
APIConstants.global.LOG_LEVEL_INFO,
|
|
912
|
-
CMIElement,
|
|
913
|
-
);
|
|
889
|
+
this.apiLog(functionName, value, LogLevelEnum.INFO, CMIElement);
|
|
914
890
|
for (let i = 0; i < this.listenerArray.length; i++) {
|
|
915
891
|
const listener = this.listenerArray[i];
|
|
916
892
|
const functionsMatch = listener.functionName === functionName;
|
|
@@ -933,7 +909,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
933
909
|
this.apiLog(
|
|
934
910
|
"processListeners",
|
|
935
911
|
`Processing listener: ${listener.functionName}`,
|
|
936
|
-
|
|
912
|
+
LogLevelEnum.INFO,
|
|
937
913
|
CMIElement,
|
|
938
914
|
);
|
|
939
915
|
listener.callback(CMIElement, value);
|
|
@@ -955,7 +931,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
955
931
|
this.apiLog(
|
|
956
932
|
"throwSCORMError",
|
|
957
933
|
errorNumber + ": " + message,
|
|
958
|
-
|
|
934
|
+
LogLevelEnum.ERROR,
|
|
959
935
|
);
|
|
960
936
|
|
|
961
937
|
this.lastErrorCode = String(errorNumber);
|
|
@@ -1067,7 +1043,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1067
1043
|
* @param {RefObject} json
|
|
1068
1044
|
* @param {string} CMIElement
|
|
1069
1045
|
*/
|
|
1070
|
-
loadFromJSON(json: RefObject, CMIElement: string) {
|
|
1046
|
+
loadFromJSON(json: RefObject, CMIElement: string = "") {
|
|
1071
1047
|
if (!this.isNotInitialized()) {
|
|
1072
1048
|
console.error(
|
|
1073
1049
|
"loadFromJSON can only be called before the call to lmsInitialize.",
|
|
@@ -1164,11 +1140,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1164
1140
|
|
|
1165
1141
|
return this.transformResponse(response);
|
|
1166
1142
|
} catch (e) {
|
|
1167
|
-
this.apiLog(
|
|
1168
|
-
"processHttpRequest",
|
|
1169
|
-
e,
|
|
1170
|
-
APIConstants.global.LOG_LEVEL_ERROR,
|
|
1171
|
-
);
|
|
1143
|
+
this.apiLog("processHttpRequest", e, LogLevelEnum.ERROR);
|
|
1172
1144
|
api.processListeners("CommitError");
|
|
1173
1145
|
return genericError;
|
|
1174
1146
|
}
|
|
@@ -1186,12 +1158,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1186
1158
|
scheduleCommit(when: number, callback: string) {
|
|
1187
1159
|
if (!this._timeout) {
|
|
1188
1160
|
this._timeout = new ScheduledCommit(this, when, callback);
|
|
1189
|
-
this.apiLog(
|
|
1190
|
-
"scheduleCommit",
|
|
1191
|
-
"scheduled",
|
|
1192
|
-
APIConstants.global.LOG_LEVEL_DEBUG,
|
|
1193
|
-
"",
|
|
1194
|
-
);
|
|
1161
|
+
this.apiLog("scheduleCommit", "scheduled", LogLevelEnum.DEBUG, "");
|
|
1195
1162
|
}
|
|
1196
1163
|
}
|
|
1197
1164
|
|
|
@@ -1202,12 +1169,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1202
1169
|
if (this._timeout) {
|
|
1203
1170
|
this._timeout.cancel();
|
|
1204
1171
|
this._timeout = undefined;
|
|
1205
|
-
this.apiLog(
|
|
1206
|
-
"clearScheduledCommit",
|
|
1207
|
-
"cleared",
|
|
1208
|
-
APIConstants.global.LOG_LEVEL_DEBUG,
|
|
1209
|
-
"",
|
|
1210
|
-
);
|
|
1172
|
+
this.apiLog("clearScheduledCommit", "cleared", LogLevelEnum.DEBUG, "");
|
|
1211
1173
|
}
|
|
1212
1174
|
}
|
|
1213
1175
|
|
|
@@ -1269,7 +1231,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1269
1231
|
? this.renderCommitObject(shouldTerminateCommit)
|
|
1270
1232
|
: this.renderCommitCMI(shouldTerminateCommit);
|
|
1271
1233
|
|
|
1272
|
-
if (
|
|
1234
|
+
if ([LogLevelEnum.DEBUG, "1", 1, "DEBUG"].includes(this.apiLogLevel)) {
|
|
1273
1235
|
console.debug(
|
|
1274
1236
|
"Commit (terminated: " + (terminateCommit ? "yes" : "no") + "): ",
|
|
1275
1237
|
);
|
package/src/Scorm12API.ts
CHANGED
|
@@ -203,7 +203,7 @@ class Scorm12Impl extends BaseAPI {
|
|
|
203
203
|
* @param {*} value
|
|
204
204
|
* @return {string}
|
|
205
205
|
*/
|
|
206
|
-
setCMIValue(CMIElement: string, value: any): string {
|
|
206
|
+
override setCMIValue(CMIElement: string, value: any): string {
|
|
207
207
|
return this._commonSetCMIValue("LMSSetValue", false, CMIElement, value);
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -213,7 +213,7 @@ class Scorm12Impl extends BaseAPI {
|
|
|
213
213
|
* @param {string} CMIElement
|
|
214
214
|
* @return {*}
|
|
215
215
|
*/
|
|
216
|
-
getCMIValue(CMIElement: string): any {
|
|
216
|
+
override getCMIValue(CMIElement: string): any {
|
|
217
217
|
return this._commonGetCMIValue("getCMIValue", false, CMIElement);
|
|
218
218
|
}
|
|
219
219
|
|
|
@@ -272,7 +272,7 @@ class Scorm12Impl extends BaseAPI {
|
|
|
272
272
|
* @param {boolean} detail
|
|
273
273
|
* @return {string}
|
|
274
274
|
*/
|
|
275
|
-
getLmsErrorMessageDetails(
|
|
275
|
+
override getLmsErrorMessageDetails(
|
|
276
276
|
errorNumber: number | string,
|
|
277
277
|
detail: boolean,
|
|
278
278
|
): string {
|
package/src/Scorm2004API.ts
CHANGED
|
@@ -128,9 +128,14 @@ class Scorm2004Impl extends BaseAPI {
|
|
|
128
128
|
const choiceJumpRegex = new RegExp(regex.scorm2004.NAVEvent);
|
|
129
129
|
const matches = request.match(choiceJumpRegex);
|
|
130
130
|
let target = "";
|
|
131
|
-
if (matches
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
if (matches) {
|
|
132
|
+
if (matches.groups?.choice_target) {
|
|
133
|
+
target = matches.groups?.choice_target;
|
|
134
|
+
request = "choice";
|
|
135
|
+
} else if (matches.groups?.jump_target) {
|
|
136
|
+
target = matches.groups?.jump_target;
|
|
137
|
+
request = "jump";
|
|
138
|
+
}
|
|
134
139
|
}
|
|
135
140
|
const action = navActions[request];
|
|
136
141
|
if (action) {
|
|
@@ -226,7 +231,7 @@ class Scorm2004Impl extends BaseAPI {
|
|
|
226
231
|
* @param {any} value
|
|
227
232
|
* @return {string}
|
|
228
233
|
*/
|
|
229
|
-
setCMIValue(CMIElement: string, value: any): string {
|
|
234
|
+
override setCMIValue(CMIElement: string, value: any): string {
|
|
230
235
|
return this._commonSetCMIValue("SetValue", true, CMIElement, value);
|
|
231
236
|
}
|
|
232
237
|
|
|
@@ -411,7 +416,7 @@ class Scorm2004Impl extends BaseAPI {
|
|
|
411
416
|
* @param {string} CMIElement
|
|
412
417
|
* @return {*}
|
|
413
418
|
*/
|
|
414
|
-
getCMIValue(CMIElement: string): any {
|
|
419
|
+
override getCMIValue(CMIElement: string): any {
|
|
415
420
|
return this._commonGetCMIValue("GetValue", true, CMIElement);
|
|
416
421
|
}
|
|
417
422
|
|
|
@@ -422,7 +427,7 @@ class Scorm2004Impl extends BaseAPI {
|
|
|
422
427
|
* @param {boolean} detail
|
|
423
428
|
* @return {string}
|
|
424
429
|
*/
|
|
425
|
-
getLmsErrorMessageDetails(
|
|
430
|
+
override getLmsErrorMessageDetails(
|
|
426
431
|
errorNumber: string | number,
|
|
427
432
|
detail: boolean,
|
|
428
433
|
): string {
|
|
@@ -718,7 +723,6 @@ class Scorm2004Impl extends BaseAPI {
|
|
|
718
723
|
this.adl.nav.request !== this.startingData?.adl?.nav?.request &&
|
|
719
724
|
this.adl.nav.request !== "_none_"
|
|
720
725
|
) {
|
|
721
|
-
this.adl.nav.request = encodeURIComponent(this.adl.nav.request);
|
|
722
726
|
navRequest = true;
|
|
723
727
|
}
|
|
724
728
|
|
package/src/cmi/aicc/attempts.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {BaseCMI} from "../common/base_cmi";
|
|
2
|
-
import {CMIScore} from "../common/score";
|
|
1
|
+
import { BaseCMI } from "../common/base_cmi";
|
|
2
|
+
import { CMIScore } from "../common/score";
|
|
3
3
|
import APIConstants from "../../constants/api_constants";
|
|
4
4
|
import Regex from "../../constants/regex";
|
|
5
5
|
import ErrorCodes from "../../constants/error_codes";
|
|
6
|
-
import {AICCValidationError} from "../../exceptions";
|
|
7
|
-
import {checkAICCValidFormat} from "./validation";
|
|
8
|
-
import {CMIArray} from "../common/array";
|
|
6
|
+
import { AICCValidationError } from "../../exceptions";
|
|
7
|
+
import { checkAICCValidFormat } from "./validation";
|
|
8
|
+
import { CMIArray } from "../common/array";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Class for cmi.student_data.attempt_records array
|
|
@@ -45,7 +45,7 @@ export class CMIAttemptRecordsObject extends BaseCMI {
|
|
|
45
45
|
/**
|
|
46
46
|
* Called when the API has been initialized after the CMI has been created
|
|
47
47
|
*/
|
|
48
|
-
initialize() {
|
|
48
|
+
override initialize() {
|
|
49
49
|
super.initialize();
|
|
50
50
|
this.score?.initialize();
|
|
51
51
|
}
|
|
@@ -91,4 +91,4 @@ export class CMIAttemptRecordsObject extends BaseCMI {
|
|
|
91
91
|
delete this.jsonString;
|
|
92
92
|
return result;
|
|
93
93
|
}
|
|
94
|
-
}
|
|
94
|
+
}
|
package/src/cmi/aicc/cmi.ts
CHANGED
|
@@ -29,8 +29,8 @@ export class CMI extends Scorm12CMI.CMI {
|
|
|
29
29
|
this.paths = new CMIPaths();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
public student_data: AICCCMIStudentData;
|
|
33
|
-
public student_preference: AICCStudentPreferences;
|
|
32
|
+
public override student_data: AICCCMIStudentData;
|
|
33
|
+
public override student_preference: AICCStudentPreferences;
|
|
34
34
|
public student_demographics: CMIStudentDemographics;
|
|
35
35
|
public evaluation: CMIEvaluation;
|
|
36
36
|
public paths: CMIPaths;
|
|
@@ -38,7 +38,7 @@ export class CMI extends Scorm12CMI.CMI {
|
|
|
38
38
|
/**
|
|
39
39
|
* Called when the API has been initialized after the CMI has been created
|
|
40
40
|
*/
|
|
41
|
-
initialize() {
|
|
41
|
+
override initialize() {
|
|
42
42
|
super.initialize();
|
|
43
43
|
this.student_preference?.initialize();
|
|
44
44
|
this.student_data?.initialize();
|
|
@@ -65,7 +65,7 @@ export class CMI extends Scorm12CMI.CMI {
|
|
|
65
65
|
* }
|
|
66
66
|
* }
|
|
67
67
|
*/
|
|
68
|
-
toJSON(): {
|
|
68
|
+
override toJSON(): {
|
|
69
69
|
suspend_data: string;
|
|
70
70
|
launch_data: string;
|
|
71
71
|
comments: string;
|
package/src/cmi/aicc/core.ts
CHANGED
|
@@ -24,7 +24,7 @@ export class AICCCMIStudentData extends CMIStudentData {
|
|
|
24
24
|
/**
|
|
25
25
|
* Called when the API has been initialized after the CMI has been created
|
|
26
26
|
*/
|
|
27
|
-
initialize() {
|
|
27
|
+
override initialize() {
|
|
28
28
|
super.initialize();
|
|
29
29
|
this.tries?.initialize();
|
|
30
30
|
this.attempt_records?.initialize();
|
|
@@ -65,7 +65,7 @@ export class AICCCMIStudentData extends CMIStudentData {
|
|
|
65
65
|
* }
|
|
66
66
|
* }
|
|
67
67
|
*/
|
|
68
|
-
toJSON(): {
|
|
68
|
+
override toJSON(): {
|
|
69
69
|
mastery_score: string;
|
|
70
70
|
max_time_allowed: string;
|
|
71
71
|
time_limit_action: string;
|
|
@@ -27,7 +27,7 @@ export class AICCStudentPreferences extends CMIStudentPreference {
|
|
|
27
27
|
/**
|
|
28
28
|
* Called when the API has been initialized after the CMI has been created
|
|
29
29
|
*/
|
|
30
|
-
initialize() {
|
|
30
|
+
override initialize() {
|
|
31
31
|
super.initialize();
|
|
32
32
|
this.windows?.initialize();
|
|
33
33
|
}
|
|
@@ -145,7 +145,7 @@ export class AICCStudentPreferences extends CMIStudentPreference {
|
|
|
145
145
|
* }
|
|
146
146
|
* }
|
|
147
147
|
*/
|
|
148
|
-
toJSON(): {
|
|
148
|
+
override toJSON(): {
|
|
149
149
|
audio: string;
|
|
150
150
|
language: string;
|
|
151
151
|
lesson_type: string;
|
package/src/cmi/aicc/tries.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {CMIArray} from "../common/array";
|
|
1
|
+
import { CMIArray } from "../common/array";
|
|
2
2
|
import APIConstants from "../../constants/api_constants";
|
|
3
|
-
import {BaseCMI} from "../common/base_cmi";
|
|
4
|
-
import {CMIScore} from "../common/score";
|
|
3
|
+
import { BaseCMI } from "../common/base_cmi";
|
|
4
|
+
import { CMIScore } from "../common/score";
|
|
5
5
|
import Regex from "../../constants/regex";
|
|
6
6
|
import ErrorCodes from "../../constants/error_codes";
|
|
7
|
-
import {AICCValidationError} from "../../exceptions";
|
|
8
|
-
import {checkAICCValidFormat} from "./validation";
|
|
7
|
+
import { AICCValidationError } from "../../exceptions";
|
|
8
|
+
import { checkAICCValidFormat } from "./validation";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Class representing the AICC cmi.student_data.tries object
|
|
@@ -45,7 +45,7 @@ export class CMITriesObject extends BaseCMI {
|
|
|
45
45
|
/**
|
|
46
46
|
* Called when the API has been initialized after the CMI has been created
|
|
47
47
|
*/
|
|
48
|
-
initialize() {
|
|
48
|
+
override initialize() {
|
|
49
49
|
super.initialize();
|
|
50
50
|
this.score?.initialize();
|
|
51
51
|
}
|
|
@@ -113,4 +113,4 @@ export class CMITriesObject extends BaseCMI {
|
|
|
113
113
|
delete this.jsonString;
|
|
114
114
|
return result;
|
|
115
115
|
}
|
|
116
|
-
}
|
|
116
|
+
}
|
package/src/cmi/scorm12/cmi.ts
CHANGED
|
@@ -51,7 +51,7 @@ export class CMIInteractionsObject extends BaseCMI {
|
|
|
51
51
|
/**
|
|
52
52
|
* Called when the API has been initialized after the CMI has been created
|
|
53
53
|
*/
|
|
54
|
-
initialize() {
|
|
54
|
+
override initialize() {
|
|
55
55
|
super.initialize();
|
|
56
56
|
this.objectives?.initialize();
|
|
57
57
|
this.correct_responses?.initialize();
|
package/src/cmi/scorm2004/adl.ts
CHANGED
|
@@ -22,7 +22,7 @@ export class ADL extends BaseCMI {
|
|
|
22
22
|
/**
|
|
23
23
|
* Called when the API has been initialized after the CMI has been created
|
|
24
24
|
*/
|
|
25
|
-
initialize() {
|
|
25
|
+
override initialize() {
|
|
26
26
|
super.initialize();
|
|
27
27
|
this.nav?.initialize();
|
|
28
28
|
}
|
|
@@ -67,7 +67,7 @@ export class ADLNav extends BaseCMI {
|
|
|
67
67
|
/**
|
|
68
68
|
* Called when the API has been initialized after the CMI has been created
|
|
69
69
|
*/
|
|
70
|
-
initialize() {
|
|
70
|
+
override initialize() {
|
|
71
71
|
super.initialize();
|
|
72
72
|
this.request_valid?.initialize();
|
|
73
73
|
}
|
package/src/cmi/scorm2004/cmi.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class CMI extends BaseRootCMI {
|
|
|
61
61
|
/**
|
|
62
62
|
* Called when the API has been initialized after the CMI has been created
|
|
63
63
|
*/
|
|
64
|
-
initialize() {
|
|
64
|
+
override initialize() {
|
|
65
65
|
super.initialize();
|
|
66
66
|
this.learner_preference?.initialize();
|
|
67
67
|
this.score?.initialize();
|
|
@@ -60,7 +60,7 @@ export class CMIInteractionsObject extends BaseCMI {
|
|
|
60
60
|
/**
|
|
61
61
|
* Called when the API has been initialized after the CMI has been created
|
|
62
62
|
*/
|
|
63
|
-
initialize() {
|
|
63
|
+
override initialize() {
|
|
64
64
|
super.initialize();
|
|
65
65
|
this.objectives?.initialize();
|
|
66
66
|
this.correct_responses?.initialize();
|
|
@@ -45,11 +45,6 @@ interface GlobalConstants {
|
|
|
45
45
|
STATE_NOT_INITIALIZED: number;
|
|
46
46
|
STATE_INITIALIZED: number;
|
|
47
47
|
STATE_TERMINATED: number;
|
|
48
|
-
LOG_LEVEL_DEBUG: number;
|
|
49
|
-
LOG_LEVEL_INFO: number;
|
|
50
|
-
LOG_LEVEL_WARNING: number;
|
|
51
|
-
LOG_LEVEL_ERROR: number;
|
|
52
|
-
LOG_LEVEL_NONE: number;
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
interface APIConstants {
|
|
@@ -65,11 +60,6 @@ const global: GlobalConstants = {
|
|
|
65
60
|
STATE_NOT_INITIALIZED: 0,
|
|
66
61
|
STATE_INITIALIZED: 1,
|
|
67
62
|
STATE_TERMINATED: 2,
|
|
68
|
-
LOG_LEVEL_DEBUG: 1,
|
|
69
|
-
LOG_LEVEL_INFO: 2,
|
|
70
|
-
LOG_LEVEL_WARNING: 3,
|
|
71
|
-
LOG_LEVEL_ERROR: 4,
|
|
72
|
-
LOG_LEVEL_NONE: 5,
|
|
73
63
|
};
|
|
74
64
|
|
|
75
65
|
const scorm12: ScormConstants = {
|