@didask/scol-r 1.0.1-beta-4 → 2.1.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.
@@ -5,6 +5,7 @@ export declare class SCORMAdapter {
5
5
  private _ignorableErrorCodes;
6
6
  constructor(errorCallback?: Function);
7
7
  get foundAPI(): boolean;
8
+ private _initialize;
8
9
  private _findAndSetAPI;
9
10
  private _findAPIInWindow;
10
11
  private _callAPIFunction;
@@ -12,6 +12,9 @@ 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
+ }
15
18
  }
16
19
  Object.defineProperty(SCORMAdapter.prototype, "foundAPI", {
17
20
  get: function () {
@@ -20,6 +23,16 @@ var SCORMAdapter = /** @class */ (function () {
20
23
  enumerable: false,
21
24
  configurable: true
22
25
  });
26
+ SCORMAdapter.prototype._initialize = function () {
27
+ if (this._isSCORM2004) {
28
+ this.LMSSetValue("cmi.score.min", 0);
29
+ this.LMSSetValue("cmi.score.max", 100);
30
+ }
31
+ else {
32
+ this.LMSSetValue("cmi.core.score.min", 0);
33
+ this.LMSSetValue("cmi.core.score.max", 100);
34
+ }
35
+ };
23
36
  SCORMAdapter.prototype._findAndSetAPI = function () {
24
37
  var _this = this;
25
38
  if (typeof window === "undefined") {
@@ -154,29 +167,32 @@ var SCORMAdapter = /** @class */ (function () {
154
167
  return this.LMSGetValue("cmi.launch_data");
155
168
  };
156
169
  SCORMAdapter.prototype.getLearnerId = function () {
157
- var CMIconstiableName = this._isSCORM2004
170
+ var CMIVariableName = this._isSCORM2004
158
171
  ? "cmi.learner_id"
159
172
  : "cmi.core.student_id";
160
- return this.LMSGetValue(CMIconstiableName);
173
+ return this.LMSGetValue(CMIVariableName);
161
174
  };
162
175
  SCORMAdapter.prototype.setScore = function (score) {
163
- var CMIconstiableName = this._isSCORM2004
164
- ? "cmi.score.raw"
165
- : "cmi.core.score.raw";
166
- this.LMSSetValue(CMIconstiableName, score);
176
+ if (this._isSCORM2004) {
177
+ this.LMSSetValue("cmi.score.raw", score);
178
+ this.LMSSetValue("cmi.score.scaled", score / 100);
179
+ }
180
+ else {
181
+ this.LMSSetValue("cmi.core.score.raw", score);
182
+ }
167
183
  };
168
184
  SCORMAdapter.prototype.getScore = function () {
169
- var CMIconstiableName = this._isSCORM2004
185
+ var CMIVariableName = this._isSCORM2004
170
186
  ? "cmi.score.raw"
171
187
  : "cmi.core.score.raw";
172
- var score = this.LMSGetValue(CMIconstiableName);
188
+ var score = this.LMSGetValue(CMIVariableName);
173
189
  return score;
174
190
  };
175
191
  SCORMAdapter.prototype.getLessonStatus = function () {
176
- var CMIconstiableName = this._isSCORM2004
192
+ var CMIVariableName = this._isSCORM2004
177
193
  ? "cmi.completion_status"
178
194
  : "cmi.core.lesson_status";
179
- return this.LMSGetValue(CMIconstiableName);
195
+ return this.LMSGetValue(CMIVariableName);
180
196
  };
181
197
  SCORMAdapter.prototype.setLessonStatus = function (lessonStatus) {
182
198
  if (this._isSCORM2004) {
@@ -202,7 +218,7 @@ var SCORMAdapter = /** @class */ (function () {
202
218
  }
203
219
  };
204
220
  SCORMAdapter.prototype.setSessionTime = function (msSessionTime) {
205
- var CMIconstiableName = this._isSCORM2004
221
+ var CMIVariableName = this._isSCORM2004
206
222
  ? "cmi.session_time"
207
223
  : "cmi.core.session_time";
208
224
  var duration;
@@ -221,7 +237,7 @@ var SCORMAdapter = /** @class */ (function () {
221
237
  duration =
222
238
  formattedHours + ":" + formattedMinutes + ":" + formattedSeconds;
223
239
  }
224
- this.LMSSetValue(CMIconstiableName, duration);
240
+ this.LMSSetValue(CMIVariableName, duration);
225
241
  };
226
242
  Object.defineProperty(SCORMAdapter.prototype, "objectivesAreAvailable", {
227
243
  get: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didask/scol-r",
3
- "version": "1.0.1-beta-4",
3
+ "version": "2.1.0",
4
4
  "description": "Shareable Cross-Origin Learning Resources",
5
5
  "main": "index.html",
6
6
  "types": "lib/index.d.ts",
@@ -8,7 +8,8 @@
8
8
  "lib/"
9
9
  ],
10
10
  "scripts": {
11
- "build": "tsc"
11
+ "build": "tsc",
12
+ "clean": "rm -rf node_modules lib"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",