Working on scheduleCommit
This commit is contained in:
12
dist/scorm-again.js
vendored
12
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
4
dist/scorm-again.min.js
vendored
4
dist/scorm-again.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -194,8 +194,8 @@ export default class BaseAPI {
|
||||
// If we didn't have any errors while setting the data, go ahead and
|
||||
// schedule a commit, if autocommit is turned on
|
||||
if (String(this.lastErrorCode) === '0') {
|
||||
if (this.#settings.autocommit && this.#timeout === undefined) {
|
||||
this.scheduleCommit(this.#settings.autocommitSeconds * 1000);
|
||||
if (this.settings.autocommit && !this.#timeout) {
|
||||
this.scheduleCommit(this.settings.autocommitSeconds * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -899,6 +899,7 @@ export default class BaseAPI {
|
||||
*/
|
||||
scheduleCommit(when: number) {
|
||||
this.#timeout = new ScheduledCommit(this, when);
|
||||
this.apiLog('scheduleCommit', null, null, global_constants.LOG_LEVEL_DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -908,6 +909,7 @@ export default class BaseAPI {
|
||||
if (this.#timeout) {
|
||||
this.#timeout.cancel();
|
||||
this.#timeout = null;
|
||||
this.apiLog('clearScheduledCommit', null, null, global_constants.LOG_LEVEL_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ export class CMI extends BaseCMI {
|
||||
* @param {string} suspend_data
|
||||
*/
|
||||
set suspend_data(suspend_data) {
|
||||
if (check2004ValidFormat(suspend_data, regex.CMIString64000)) {
|
||||
if (check2004ValidFormat(suspend_data, regex.CMIString64000, true)) {
|
||||
this.#suspend_data = suspend_data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user