Adding setting to always commit total_time, listeners for commit requests
This commit is contained in:
17
dist/scorm-again.js
vendored
17
dist/scorm-again.js
vendored
File diff suppressed because one or more lines are too long
2
dist/scorm-again.js.map
vendored
2
dist/scorm-again.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/scorm-again.min.js
vendored
6
dist/scorm-again.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "scorm-again",
|
"name": "scorm-again",
|
||||||
"version": "1.3.6",
|
"version": "1.4.0",
|
||||||
"description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
|
"description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
|
||||||
"main": "dist/scorm-again.min.js",
|
"main": "dist/scorm-again.min.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export default class BaseAPI {
|
|||||||
autoProgress: false,
|
autoProgress: false,
|
||||||
logLevel: global_constants.LOG_LEVEL_ERROR,
|
logLevel: global_constants.LOG_LEVEL_ERROR,
|
||||||
selfReportSessionTime: false,
|
selfReportSessionTime: false,
|
||||||
|
alwaysSendTotalTime: false,
|
||||||
responseHandler: function(xhr) {
|
responseHandler: function(xhr) {
|
||||||
let result;
|
let result;
|
||||||
if (typeof xhr !== 'undefined') {
|
if (typeof xhr !== 'undefined') {
|
||||||
@@ -1065,7 +1066,13 @@ export default class BaseAPI {
|
|||||||
errorCode: 0,
|
errorCode: 0,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return process(url, params, this.settings, this.error_codes);
|
const result = process(url, params, this.settings, this.error_codes);
|
||||||
|
if (result.errorCode === 0) {
|
||||||
|
this.processListeners('CommitSuccess');
|
||||||
|
} else {
|
||||||
|
this.processListeners('CommitError');
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -294,7 +294,8 @@ export default class Scorm12API extends BaseAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const commitObject = this.renderCommitCMI(terminateCommit);
|
const commitObject = this.renderCommitCMI(terminateCommit ||
|
||||||
|
this.settings.alwaysSendTotalTime);
|
||||||
|
|
||||||
if (this.settings.lmsCommitUrl) {
|
if (this.settings.lmsCommitUrl) {
|
||||||
if (this.apiLogLevel === global_constants.LOG_LEVEL_DEBUG) {
|
if (this.apiLogLevel === global_constants.LOG_LEVEL_DEBUG) {
|
||||||
@@ -302,7 +303,8 @@ export default class Scorm12API extends BaseAPI {
|
|||||||
(terminateCommit ? 'yes' : 'no') + '): ');
|
(terminateCommit ? 'yes' : 'no') + '): ');
|
||||||
console.debug(commitObject);
|
console.debug(commitObject);
|
||||||
}
|
}
|
||||||
return this.processHttpRequest(this.settings.lmsCommitUrl, commitObject, terminateCommit);
|
return this.processHttpRequest(this.settings.lmsCommitUrl, commitObject,
|
||||||
|
terminateCommit);
|
||||||
} else {
|
} else {
|
||||||
console.log('Commit (terminated: ' +
|
console.log('Commit (terminated: ' +
|
||||||
(terminateCommit ? 'yes' : 'no') + '): ');
|
(terminateCommit ? 'yes' : 'no') + '): ');
|
||||||
|
|||||||
@@ -547,7 +547,8 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
navRequest = true;
|
navRequest = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const commitObject = this.renderCommitCMI(terminateCommit);
|
const commitObject = this.renderCommitCMI(terminateCommit ||
|
||||||
|
this.settings.alwaysSendTotalTime);
|
||||||
|
|
||||||
if (this.settings.lmsCommitUrl) {
|
if (this.settings.lmsCommitUrl) {
|
||||||
if (this.apiLogLevel === global_constants.LOG_LEVEL_DEBUG) {
|
if (this.apiLogLevel === global_constants.LOG_LEVEL_DEBUG) {
|
||||||
@@ -561,7 +562,7 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
// check if this is a sequencing call, and then call the necessary JS
|
// check if this is a sequencing call, and then call the necessary JS
|
||||||
{
|
{
|
||||||
if (navRequest && result.navRequest !== undefined &&
|
if (navRequest && result.navRequest !== undefined &&
|
||||||
result.navRequest !== '') {
|
result.navRequest !== '') {
|
||||||
Function(`"use strict";(() => { ${result.navRequest} })()`)();
|
Function(`"use strict";(() => { ${result.navRequest} })()`)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user