@didask/scol-r 2.1.0 → 2.2.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.
@@ -12,9 +12,6 @@ var SCORMAdapter = /** @class */ (function () {
12
12
  this._isSCORM2004 = false;
13
13
  this._errorCallback = errorCallback;
14
14
  this._findAndSetAPI();
15
- if (this._API) {
16
- this._initialize();
17
- }
18
15
  }
19
16
  Object.defineProperty(SCORMAdapter.prototype, "foundAPI", {
20
17
  get: function () {
@@ -129,6 +126,9 @@ var SCORMAdapter = /** @class */ (function () {
129
126
  (this._isSCORM2004
130
127
  ? lastErrorCode === 103 // 103 in 2004.* = already initialized
131
128
  : lastErrorCode === 101); // 101 in 1.2 = already initialized
129
+ if (success) {
130
+ this._initialize();
131
+ }
132
132
  return success || this._handleError(functionName);
133
133
  };
134
134
  SCORMAdapter.prototype.LMSTerminate = function () {
@@ -241,7 +241,8 @@ var SCORMAdapter = /** @class */ (function () {
241
241
  };
242
242
  Object.defineProperty(SCORMAdapter.prototype, "objectivesAreAvailable", {
243
243
  get: function () {
244
- return this.LMSGetValue("cmi.objectives._children") !== null;
244
+ var objectivesFields = !!this.LMSGetValue("cmi.objectives._children");
245
+ return objectivesFields && this.LMSGetLastError() === 0;
245
246
  },
246
247
  enumerable: false,
247
248
  configurable: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didask/scol-r",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Shareable Cross-Origin Learning Resources",
5
5
  "main": "index.html",
6
6
  "types": "lib/index.d.ts",