scorm-again 3.0.3 → 3.0.5
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 +19 -4
- package/dist/esm/scorm-again.js +133 -68
- 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 +20 -5
- 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 +133 -68
- 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 +261 -166
- 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 +14 -6
- 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 +261 -166
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -1
- package/dist/types/cmi/scorm2004/interaction_delimiters.d.ts +4 -0
- package/package.json +46 -25
package/dist/esm/scorm12.js
CHANGED
|
@@ -1418,7 +1418,19 @@ class CMIValueAccessService {
|
|
|
1418
1418
|
if (!scorm2004) {
|
|
1419
1419
|
if (isFinalAttribute) {
|
|
1420
1420
|
if (typeof attribute === "undefined" || !this.context.checkObjectHasProperty(refObject, attribute)) {
|
|
1421
|
-
|
|
1421
|
+
if (attribute === "_children") {
|
|
1422
|
+
this.context.throwSCORMError(
|
|
1423
|
+
CMIElement,
|
|
1424
|
+
getErrorCode(this.context.errorCodes, "CHILDREN_ERROR")
|
|
1425
|
+
);
|
|
1426
|
+
} else if (attribute === "_count") {
|
|
1427
|
+
this.context.throwSCORMError(
|
|
1428
|
+
CMIElement,
|
|
1429
|
+
getErrorCode(this.context.errorCodes, "COUNT_ERROR")
|
|
1430
|
+
);
|
|
1431
|
+
} else {
|
|
1432
|
+
this.context.throwSCORMError(CMIElement, invalidErrorCode, invalidErrorMessage);
|
|
1433
|
+
}
|
|
1422
1434
|
return { error: true };
|
|
1423
1435
|
}
|
|
1424
1436
|
}
|
|
@@ -1610,7 +1622,8 @@ class LoggingService {
|
|
|
1610
1622
|
getNumericLevel(level) {
|
|
1611
1623
|
if (level === void 0) return LogLevelEnum.NONE;
|
|
1612
1624
|
if (typeof level === "number") return level;
|
|
1613
|
-
|
|
1625
|
+
const normalized = typeof level === "string" ? level.toUpperCase() : level;
|
|
1626
|
+
switch (normalized) {
|
|
1614
1627
|
case "1":
|
|
1615
1628
|
case "DEBUG":
|
|
1616
1629
|
return LogLevelEnum.DEBUG;
|
|
@@ -1983,6 +1996,7 @@ class OfflineStorageService {
|
|
|
1983
1996
|
window.addEventListener("offline", this.boundOnlineStatusChangeHandler);
|
|
1984
1997
|
window.addEventListener("scorm-again:network-status", this.boundCustomNetworkStatusHandler);
|
|
1985
1998
|
}
|
|
1999
|
+
apiLog;
|
|
1986
2000
|
settings;
|
|
1987
2001
|
error_codes;
|
|
1988
2002
|
storeName = "scorm_again_offline_data";
|
|
@@ -3252,7 +3266,8 @@ class BaseAPI {
|
|
|
3252
3266
|
if (errorCode === 143) returnValue = global_constants.SCORM_FALSE;
|
|
3253
3267
|
} else {
|
|
3254
3268
|
const result = this.storeData(false);
|
|
3255
|
-
|
|
3269
|
+
const errorCode = result.errorCode ?? 0;
|
|
3270
|
+
if (errorCode > 0) {
|
|
3256
3271
|
if (result.errorMessage) {
|
|
3257
3272
|
this.apiLog(
|
|
3258
3273
|
"commit",
|
|
@@ -3267,12 +3282,12 @@ class BaseAPI {
|
|
|
3267
3282
|
LogLevelEnum.DEBUG
|
|
3268
3283
|
);
|
|
3269
3284
|
}
|
|
3270
|
-
this.throwSCORMError("api",
|
|
3285
|
+
this.throwSCORMError("api", errorCode);
|
|
3271
3286
|
}
|
|
3272
3287
|
const resultValue = result?.result ?? global_constants.SCORM_FALSE;
|
|
3273
3288
|
returnValue = typeof resultValue === "boolean" ? String(resultValue) : resultValue;
|
|
3274
3289
|
this.apiLog(callbackName, " Result: " + returnValue, LogLevelEnum.DEBUG, "HttpRequest");
|
|
3275
|
-
if (checkTerminated) this.lastErrorCode = "0";
|
|
3290
|
+
if (checkTerminated && errorCode === 0) this.lastErrorCode = "0";
|
|
3276
3291
|
this.processListeners(callbackName);
|
|
3277
3292
|
if (this.settings.enableOfflineSupport && this._offlineStorageService && this._offlineStorageService.isDeviceOnline() && this._courseId) {
|
|
3278
3293
|
this._offlineStorageService.hasPendingOfflineData(this._courseId).then((hasPendingData) => {
|