scorm-again 2.5.0 → 2.6.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/dist/aicc.js +648 -485
- 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 +664 -488
- 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 +1111 -729
- 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 +506 -393
- 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 +672 -451
- 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 +1087 -717
- 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 +493 -392
- 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 +658 -450
- 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 +14 -14
- package/src/AICC.ts +3 -0
- package/src/BaseAPI.ts +33 -30
- package/src/Scorm12API.ts +14 -14
- package/src/Scorm2004API.ts +99 -33
- package/src/cmi/aicc/attempts.ts +22 -12
- package/src/cmi/aicc/cmi.ts +2 -2
- package/src/cmi/aicc/core.ts +44 -26
- package/src/cmi/aicc/evaluation.ts +31 -12
- package/src/cmi/aicc/paths.ts +29 -15
- package/src/cmi/aicc/student_data.ts +14 -5
- package/src/cmi/aicc/student_demographics.ts +31 -24
- package/src/cmi/aicc/student_preferences.ts +11 -11
- package/src/cmi/aicc/tries.ts +24 -14
- package/src/cmi/aicc/validation.ts +3 -4
- package/src/cmi/common/array.ts +17 -5
- package/src/cmi/common/base_cmi.ts +3 -1
- package/src/cmi/common/score.ts +16 -13
- package/src/cmi/scorm12/cmi.ts +25 -10
- package/src/cmi/scorm12/interactions.ts +62 -28
- package/src/cmi/scorm12/nav.ts +13 -5
- package/src/cmi/scorm12/objectives.ts +28 -18
- package/src/cmi/scorm12/student_data.ts +15 -8
- package/src/cmi/scorm12/student_preference.ts +20 -13
- package/src/cmi/scorm12/validation.ts +7 -7
- package/src/cmi/scorm2004/adl.ts +141 -25
- package/src/cmi/scorm2004/cmi.ts +50 -55
- package/src/cmi/scorm2004/comments.ts +21 -20
- package/src/cmi/scorm2004/interactions.ts +73 -32
- package/src/cmi/scorm2004/learner_preference.ts +20 -13
- package/src/cmi/scorm2004/objectives.ts +41 -16
- package/src/cmi/scorm2004/score.ts +22 -11
- package/src/cmi/scorm2004/validation.ts +4 -4
- package/src/constants/api_constants.ts +8 -19
- package/src/constants/default_settings.ts +6 -5
- package/src/constants/error_codes.ts +5 -12
- package/src/constants/regex.ts +4 -10
- package/src/constants/response_constants.ts +1 -2
- package/src/exceptions/aicc_exceptions.ts +29 -0
- package/src/exceptions/scorm12_exceptions.ts +29 -0
- package/src/exceptions/scorm2004_exceptions.ts +29 -0
- package/src/exceptions.ts +0 -81
- package/src/types/api_types.ts +3 -2
- package/test/AICC.spec.ts +114 -43
- package/test/Scorm12API.spec.ts +37 -39
- package/test/Scorm2004API.spec.ts +165 -80
- package/test/cmi/aicc_cmi.spec.ts +6 -9
- package/test/cmi/scorm12_cmi.spec.ts +8 -8
- package/test/cmi/scorm2004_cmi.spec.ts +8 -9
- package/test/exceptions.spec.ts +11 -9
- package/test/types/api_types.spec.ts +3 -3
- package/test/utilities.spec.ts +1 -4
- package/webpack.config.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scorm-again",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.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",
|
|
@@ -22,47 +22,47 @@
|
|
|
22
22
|
"test": "test"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "^7.
|
|
25
|
+
"@babel/cli": "^7.26.4",
|
|
26
26
|
"@babel/core": "^7.26.0",
|
|
27
27
|
"@babel/eslint-parser": "^7.25.9",
|
|
28
28
|
"@babel/node": "^7.26.0",
|
|
29
29
|
"@babel/preset-env": "^7.26.0",
|
|
30
30
|
"@babel/preset-typescript": "^7.26.0",
|
|
31
|
-
"@eslint/eslintrc": "^3.
|
|
32
|
-
"@eslint/js": "^9.
|
|
31
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
32
|
+
"@eslint/js": "^9.16.0",
|
|
33
33
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
34
34
|
"@types/eslint__js": "^8.42.3",
|
|
35
|
-
"@types/mocha": "^10.0.
|
|
35
|
+
"@types/mocha": "^10.0.10",
|
|
36
36
|
"@types/sinon": "^17.0.3",
|
|
37
37
|
"babel-eslint": "^11.0.0-beta.2",
|
|
38
38
|
"babel-loader": "^9.2.1",
|
|
39
39
|
"babelify": "^10.0.0",
|
|
40
40
|
"browserify": "^17.0.1",
|
|
41
|
-
"c8": "^10.1.
|
|
41
|
+
"c8": "^10.1.3",
|
|
42
42
|
"c8-as-nyc": "^1.1.11",
|
|
43
|
-
"eslint": "^9.
|
|
43
|
+
"eslint": "^9.16.0",
|
|
44
44
|
"eslint-formatter-junit": "^8.40.0",
|
|
45
45
|
"eslint-plugin-import": "^2.31.0",
|
|
46
|
-
"eslint-plugin-jsdoc": "^50.
|
|
46
|
+
"eslint-plugin-jsdoc": "^50.6.1",
|
|
47
47
|
"eslint-webpack-plugin": "^4.2.0",
|
|
48
48
|
"expect": "^29.7.0",
|
|
49
49
|
"fetch-pretender": "https://github.com/jcputney/fetch-pretender#master",
|
|
50
|
-
"globals": "^15.
|
|
50
|
+
"globals": "^15.13.0",
|
|
51
51
|
"jsdoc": "^4.0.4",
|
|
52
52
|
"jsdoc-babel": "^0.5.0",
|
|
53
53
|
"minimist": "^1.2.8",
|
|
54
54
|
"miragejs": "^0.2.0-alpha.3",
|
|
55
|
-
"mocha": "^
|
|
55
|
+
"mocha": "^11.0.1",
|
|
56
56
|
"mocha-junit-reporter": "^2.2.1",
|
|
57
57
|
"mochawesome": "^7.1.3",
|
|
58
|
-
"prettier": "^3.
|
|
58
|
+
"prettier": "^3.4.2",
|
|
59
59
|
"sinon": "^19.0.2",
|
|
60
60
|
"terser-webpack-plugin": "^5.3.10",
|
|
61
61
|
"ts-loader": "^9.5.1",
|
|
62
62
|
"tsx": "^4.19.2",
|
|
63
|
-
"typescript": "^5.
|
|
64
|
-
"typescript-eslint": "^8.
|
|
65
|
-
"webpack": "^5.
|
|
63
|
+
"typescript": "^5.7.2",
|
|
64
|
+
"typescript-eslint": "^8.18.0",
|
|
65
|
+
"webpack": "^5.97.1",
|
|
66
66
|
"webpack-cli": "^5.1.4"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
package/src/AICC.ts
CHANGED
package/src/BaseAPI.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CMIArray } from "./cmi/common/array";
|
|
2
2
|
import { ValidationError } from "./exceptions";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import { ErrorCode } from "./constants/error_codes";
|
|
4
|
+
import { global_constants } from "./constants/api_constants";
|
|
5
5
|
import { formatMessage, stringMatches, unflatten } from "./utilities";
|
|
6
6
|
import { BaseCMI } from "./cmi/common/base_cmi";
|
|
7
7
|
import {
|
|
@@ -35,7 +35,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
35
35
|
if (new.target === BaseAPI) {
|
|
36
36
|
throw new TypeError("Cannot construct BaseAPI instances directly");
|
|
37
37
|
}
|
|
38
|
-
this.currentState =
|
|
38
|
+
this.currentState = global_constants.STATE_NOT_INITIALIZED;
|
|
39
39
|
this.lastErrorCode = "0";
|
|
40
40
|
this.listenerArray = [];
|
|
41
41
|
|
|
@@ -69,11 +69,15 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
69
69
|
* @protected
|
|
70
70
|
*/
|
|
71
71
|
commonReset(settings?: Settings): void {
|
|
72
|
+
this.apiLog("reset", "Called", LogLevelEnum.INFO);
|
|
73
|
+
|
|
72
74
|
this.settings = { ...this.settings, ...settings };
|
|
73
75
|
|
|
74
|
-
this.
|
|
76
|
+
this.clearScheduledCommit();
|
|
77
|
+
this.currentState = global_constants.STATE_NOT_INITIALIZED;
|
|
75
78
|
this.lastErrorCode = "0";
|
|
76
79
|
this.listenerArray = [];
|
|
80
|
+
this.startingData = undefined;
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
/**
|
|
@@ -88,7 +92,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
88
92
|
initializeMessage?: string,
|
|
89
93
|
terminationMessage?: string,
|
|
90
94
|
): string {
|
|
91
|
-
let returnValue =
|
|
95
|
+
let returnValue = global_constants.SCORM_FALSE;
|
|
92
96
|
|
|
93
97
|
if (this.isInitialized()) {
|
|
94
98
|
this.throwSCORMError(this._error_codes.INITIALIZED, initializeMessage);
|
|
@@ -99,9 +103,9 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
99
103
|
this.cmi.setStartTime();
|
|
100
104
|
}
|
|
101
105
|
|
|
102
|
-
this.currentState =
|
|
106
|
+
this.currentState = global_constants.STATE_INITIALIZED;
|
|
103
107
|
this.lastErrorCode = "0";
|
|
104
|
-
returnValue =
|
|
108
|
+
returnValue = global_constants.SCORM_TRUE;
|
|
105
109
|
this.processListeners(callbackName);
|
|
106
110
|
}
|
|
107
111
|
|
|
@@ -233,7 +237,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
233
237
|
callbackName: string,
|
|
234
238
|
checkTerminated: boolean,
|
|
235
239
|
): Promise<string> {
|
|
236
|
-
let returnValue =
|
|
240
|
+
let returnValue = global_constants.SCORM_FALSE;
|
|
237
241
|
|
|
238
242
|
if (
|
|
239
243
|
this.checkState(
|
|
@@ -242,7 +246,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
242
246
|
this._error_codes.MULTIPLE_TERMINATION,
|
|
243
247
|
)
|
|
244
248
|
) {
|
|
245
|
-
this.currentState =
|
|
249
|
+
this.currentState = global_constants.STATE_TERMINATED;
|
|
246
250
|
|
|
247
251
|
const result: ResultObject = await this.storeData(true);
|
|
248
252
|
if (typeof result.errorCode !== "undefined" && result.errorCode > 0) {
|
|
@@ -251,11 +255,11 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
251
255
|
returnValue =
|
|
252
256
|
typeof result !== "undefined" && result.result
|
|
253
257
|
? result.result
|
|
254
|
-
:
|
|
258
|
+
: global_constants.SCORM_FALSE;
|
|
255
259
|
|
|
256
260
|
if (checkTerminated) this.lastErrorCode = "0";
|
|
257
261
|
|
|
258
|
-
returnValue =
|
|
262
|
+
returnValue = global_constants.SCORM_TRUE;
|
|
259
263
|
this.processListeners(callbackName);
|
|
260
264
|
}
|
|
261
265
|
|
|
@@ -332,7 +336,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
332
336
|
if (value !== undefined) {
|
|
333
337
|
value = String(value);
|
|
334
338
|
}
|
|
335
|
-
let returnValue: string =
|
|
339
|
+
let returnValue: string = global_constants.SCORM_FALSE;
|
|
336
340
|
|
|
337
341
|
if (
|
|
338
342
|
this.checkState(
|
|
@@ -351,7 +355,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
351
355
|
}
|
|
352
356
|
|
|
353
357
|
if (returnValue === undefined) {
|
|
354
|
-
returnValue =
|
|
358
|
+
returnValue = global_constants.SCORM_FALSE;
|
|
355
359
|
}
|
|
356
360
|
|
|
357
361
|
// If we didn't have any errors while setting the data, go ahead and
|
|
@@ -388,7 +392,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
388
392
|
): Promise<string> {
|
|
389
393
|
this.clearScheduledCommit();
|
|
390
394
|
|
|
391
|
-
let returnValue =
|
|
395
|
+
let returnValue = global_constants.SCORM_FALSE;
|
|
392
396
|
|
|
393
397
|
if (
|
|
394
398
|
this.checkState(
|
|
@@ -404,7 +408,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
404
408
|
returnValue =
|
|
405
409
|
typeof result !== "undefined" && result.result
|
|
406
410
|
? result.result
|
|
407
|
-
:
|
|
411
|
+
: global_constants.SCORM_FALSE;
|
|
408
412
|
|
|
409
413
|
this.apiLog(
|
|
410
414
|
callbackName,
|
|
@@ -562,12 +566,12 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
562
566
|
value: any,
|
|
563
567
|
): string {
|
|
564
568
|
if (!CMIElement || CMIElement === "") {
|
|
565
|
-
return
|
|
569
|
+
return global_constants.SCORM_FALSE;
|
|
566
570
|
}
|
|
567
571
|
|
|
568
572
|
const structure = CMIElement.split(".");
|
|
569
573
|
let refObject: RefObject = this;
|
|
570
|
-
let returnValue =
|
|
574
|
+
let returnValue = global_constants.SCORM_FALSE;
|
|
571
575
|
let foundFirstIndex = false;
|
|
572
576
|
|
|
573
577
|
const invalidErrorMessage = `The data model element passed to ${methodName} (${CMIElement}) is not a valid SCORM data model element.`;
|
|
@@ -600,7 +604,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
600
604
|
|
|
601
605
|
if (!scorm2004 || this.lastErrorCode === "0") {
|
|
602
606
|
refObject[attribute] = value;
|
|
603
|
-
returnValue =
|
|
607
|
+
returnValue = global_constants.SCORM_TRUE;
|
|
604
608
|
}
|
|
605
609
|
}
|
|
606
610
|
} else {
|
|
@@ -645,7 +649,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
645
649
|
}
|
|
646
650
|
}
|
|
647
651
|
|
|
648
|
-
if (returnValue ===
|
|
652
|
+
if (returnValue === global_constants.SCORM_FALSE) {
|
|
649
653
|
this.apiLog(
|
|
650
654
|
methodName,
|
|
651
655
|
`There was an error setting the value for: ${CMIElement}, value of: ${value}`,
|
|
@@ -741,9 +745,9 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
741
745
|
if (refObject === null || refObject === undefined) {
|
|
742
746
|
if (!scorm2004) {
|
|
743
747
|
if (attribute === "_children") {
|
|
744
|
-
this.throwSCORMError(
|
|
748
|
+
this.throwSCORMError(this._error_codes.CHILDREN_ERROR);
|
|
745
749
|
} else if (attribute === "_count") {
|
|
746
|
-
this.throwSCORMError(
|
|
750
|
+
this.throwSCORMError(this._error_codes.COUNT_ERROR);
|
|
747
751
|
}
|
|
748
752
|
}
|
|
749
753
|
} else {
|
|
@@ -757,7 +761,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
757
761
|
* @return {boolean}
|
|
758
762
|
*/
|
|
759
763
|
isInitialized(): boolean {
|
|
760
|
-
return this.currentState ===
|
|
764
|
+
return this.currentState === global_constants.STATE_INITIALIZED;
|
|
761
765
|
}
|
|
762
766
|
|
|
763
767
|
/**
|
|
@@ -766,7 +770,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
766
770
|
* @return {boolean}
|
|
767
771
|
*/
|
|
768
772
|
isNotInitialized(): boolean {
|
|
769
|
-
return this.currentState ===
|
|
773
|
+
return this.currentState === global_constants.STATE_NOT_INITIALIZED;
|
|
770
774
|
}
|
|
771
775
|
|
|
772
776
|
/**
|
|
@@ -775,7 +779,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
775
779
|
* @return {boolean}
|
|
776
780
|
*/
|
|
777
781
|
isTerminated(): boolean {
|
|
778
|
-
return this.currentState ===
|
|
782
|
+
return this.currentState === global_constants.STATE_TERMINATED;
|
|
779
783
|
}
|
|
780
784
|
|
|
781
785
|
/**
|
|
@@ -943,7 +947,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
943
947
|
* @param {string} success
|
|
944
948
|
*/
|
|
945
949
|
clearSCORMError(success: string) {
|
|
946
|
-
if (success !== undefined && success !==
|
|
950
|
+
if (success !== undefined && success !== global_constants.SCORM_FALSE) {
|
|
947
951
|
this.lastErrorCode = "0";
|
|
948
952
|
}
|
|
949
953
|
}
|
|
@@ -1113,7 +1117,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1113
1117
|
): Promise<ResultObject> {
|
|
1114
1118
|
const api = this;
|
|
1115
1119
|
const genericError: ResultObject = {
|
|
1116
|
-
result:
|
|
1120
|
+
result: global_constants.SCORM_FALSE,
|
|
1117
1121
|
errorCode: this.error_codes.GENERAL,
|
|
1118
1122
|
};
|
|
1119
1123
|
|
|
@@ -1124,7 +1128,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1124
1128
|
await this.transformResponse(response);
|
|
1125
1129
|
});
|
|
1126
1130
|
return {
|
|
1127
|
-
result:
|
|
1131
|
+
result: global_constants.SCORM_TRUE,
|
|
1128
1132
|
errorCode: 0,
|
|
1129
1133
|
};
|
|
1130
1134
|
}
|
|
@@ -1204,7 +1208,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1204
1208
|
private handleValueAccessException(e: any, returnValue: string): string {
|
|
1205
1209
|
if (e instanceof ValidationError) {
|
|
1206
1210
|
this.lastErrorCode = String(e.errorCode);
|
|
1207
|
-
returnValue =
|
|
1211
|
+
returnValue = global_constants.SCORM_FALSE;
|
|
1208
1212
|
} else {
|
|
1209
1213
|
if (e instanceof Error && e.message) {
|
|
1210
1214
|
console.error(e.message);
|
|
@@ -1279,8 +1283,7 @@ export default abstract class BaseAPI implements IBaseAPI {
|
|
|
1279
1283
|
if (
|
|
1280
1284
|
response.status >= 200 &&
|
|
1281
1285
|
response.status <= 299 &&
|
|
1282
|
-
(result.result === true ||
|
|
1283
|
-
result.result === APIConstants.global.SCORM_TRUE)
|
|
1286
|
+
(result.result === true || result.result === global_constants.SCORM_TRUE)
|
|
1284
1287
|
) {
|
|
1285
1288
|
this.processListeners("CommitSuccess");
|
|
1286
1289
|
} else {
|
package/src/Scorm12API.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CMI } from "./cmi/scorm12/cmi";
|
|
2
2
|
import * as Utilities from "./utilities";
|
|
3
3
|
import { stringMatches } from "./utilities";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { global_constants, scorm12_constants } from "./constants/api_constants";
|
|
5
|
+
import { scorm12_errors } from "./constants/error_codes";
|
|
6
6
|
|
|
7
7
|
import { BaseCMI } from "./cmi/common/base_cmi";
|
|
8
8
|
import { CMIObjectivesObject } from "./cmi/scorm12/objectives";
|
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
ScoreObject,
|
|
20
20
|
Settings,
|
|
21
21
|
} from "./types/api_types";
|
|
22
|
-
import Regex from "./constants/regex";
|
|
23
22
|
import { CompletionStatus, SuccessStatus } from "./constants/enums";
|
|
24
23
|
import BaseAPI from "./BaseAPI";
|
|
24
|
+
import { scorm12_regex } from "./constants/regex";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* API class for SCORM 1.2
|
|
@@ -38,7 +38,7 @@ class Scorm12Impl extends BaseAPI {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
super(
|
|
41
|
+
super(scorm12_errors, settings);
|
|
42
42
|
|
|
43
43
|
this.cmi = new CMI();
|
|
44
44
|
this.nav = new NAV();
|
|
@@ -74,8 +74,8 @@ class Scorm12Impl extends BaseAPI {
|
|
|
74
74
|
reset(settings?: Settings) {
|
|
75
75
|
this.commonReset(settings);
|
|
76
76
|
|
|
77
|
-
this.cmi
|
|
78
|
-
this.nav
|
|
77
|
+
this.cmi?.reset();
|
|
78
|
+
this.nav?.reset();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -106,13 +106,13 @@ class Scorm12Impl extends BaseAPI {
|
|
|
106
106
|
(async () => {
|
|
107
107
|
await this.internalFinish();
|
|
108
108
|
})();
|
|
109
|
-
return
|
|
109
|
+
return global_constants.SCORM_TRUE;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
async internalFinish(): Promise<string> {
|
|
113
113
|
const result = await this.terminate("LMSFinish", true);
|
|
114
114
|
|
|
115
|
-
if (result ===
|
|
115
|
+
if (result === global_constants.SCORM_TRUE) {
|
|
116
116
|
if (this.nav.event !== "") {
|
|
117
117
|
if (this.nav.event === "continue") {
|
|
118
118
|
this.processListeners("SequenceNext");
|
|
@@ -164,7 +164,7 @@ class Scorm12Impl extends BaseAPI {
|
|
|
164
164
|
await this.commit("LMSCommit", false);
|
|
165
165
|
})();
|
|
166
166
|
}
|
|
167
|
-
return
|
|
167
|
+
return global_constants.SCORM_TRUE;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
/**
|
|
@@ -281,11 +281,11 @@ class Scorm12Impl extends BaseAPI {
|
|
|
281
281
|
|
|
282
282
|
// Set error number to string since inconsistent from modules if string or number
|
|
283
283
|
errorNumber = String(errorNumber);
|
|
284
|
-
if (
|
|
284
|
+
if (scorm12_constants.error_descriptions[errorNumber]) {
|
|
285
285
|
basicMessage =
|
|
286
|
-
|
|
286
|
+
scorm12_constants.error_descriptions[errorNumber].basicMessage;
|
|
287
287
|
detailMessage =
|
|
288
|
-
|
|
288
|
+
scorm12_constants.error_descriptions[errorNumber].detailMessage;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
return detail ? detailMessage : basicMessage;
|
|
@@ -342,7 +342,7 @@ class Scorm12Impl extends BaseAPI {
|
|
|
342
342
|
const totalTimeHHMMSS = this.cmi.getCurrentTotalTime();
|
|
343
343
|
const totalTimeSeconds = Utilities.getTimeAsSeconds(
|
|
344
344
|
totalTimeHHMMSS,
|
|
345
|
-
|
|
345
|
+
scorm12_regex.CMITimespan,
|
|
346
346
|
);
|
|
347
347
|
const lessonStatus = this.cmi.core.lesson_status;
|
|
348
348
|
let completionStatus = CompletionStatus.unknown;
|
|
@@ -437,7 +437,7 @@ class Scorm12Impl extends BaseAPI {
|
|
|
437
437
|
);
|
|
438
438
|
} else {
|
|
439
439
|
return {
|
|
440
|
-
result:
|
|
440
|
+
result: global_constants.SCORM_TRUE,
|
|
441
441
|
errorCode: 0,
|
|
442
442
|
};
|
|
443
443
|
}
|