@didask/scol-r 2.2.2 → 2.2.4
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/lib/SCORMAdapter.js +15 -16
- package/package.json +1 -1
package/lib/SCORMAdapter.js
CHANGED
|
@@ -3,31 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SCORMAdapter = void 0;
|
|
4
4
|
var SCORMAdapter = /** @class */ (function () {
|
|
5
5
|
function SCORMAdapter(errorCallback) {
|
|
6
|
+
var _this = this;
|
|
6
7
|
if (errorCallback === void 0) { errorCallback = function () { }; }
|
|
7
8
|
this._ignorableErrorCodes = [
|
|
8
|
-
{ code: 0,
|
|
9
|
+
{ code: 0, getShouldBeIgnored: function () { return true; } },
|
|
9
10
|
{
|
|
10
11
|
code: 403,
|
|
11
|
-
|
|
12
|
-
return this._isSCORM2004;
|
|
13
|
-
},
|
|
12
|
+
getShouldBeIgnored: function () { return _this._isSCORM2004; },
|
|
14
13
|
},
|
|
15
14
|
{
|
|
16
15
|
code: 401,
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
getShouldBeIgnored: function () {
|
|
17
|
+
return !_this._isSCORM2004 &&
|
|
18
|
+
_this._lastRequest &&
|
|
19
|
+
_this._lastRequest.method === "get" &&
|
|
20
|
+
_this._lastRequest.key === "cmi.objectives._children";
|
|
22
21
|
},
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
24
|
code: 402,
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
getShouldBeIgnored: function () {
|
|
26
|
+
return _this._isSCORM2004 &&
|
|
27
|
+
_this._lastRequest &&
|
|
28
|
+
_this._lastRequest.method === "get" &&
|
|
29
|
+
_this._lastRequest.key === "cmi.objectives._children";
|
|
31
30
|
},
|
|
32
31
|
},
|
|
33
32
|
];
|
|
@@ -124,8 +123,8 @@ var SCORMAdapter = /** @class */ (function () {
|
|
|
124
123
|
var lastErrorString = this.LMSGetErrorString(lastErrorCode);
|
|
125
124
|
var lastErrorDiagnostic = this.LMSGetDiagnostic(lastErrorCode);
|
|
126
125
|
if (!this._ignorableErrorCodes.some(function (_a) {
|
|
127
|
-
var code = _a.code,
|
|
128
|
-
return code === lastErrorCode &&
|
|
126
|
+
var code = _a.code, getShouldBeIgnored = _a.getShouldBeIgnored;
|
|
127
|
+
return code === lastErrorCode && getShouldBeIgnored();
|
|
129
128
|
})) {
|
|
130
129
|
console.warn(functionName, "An error occured on the SCORM API: code " + lastErrorCode + ", message: " + lastErrorString, lastErrorDiagnostic);
|
|
131
130
|
this._errorCallback(lastErrorString, lastErrorDiagnostic && lastErrorDiagnostic != lastErrorCode
|