Working on scheduleCommit

This commit is contained in:
Jonathan Putney
2019-11-19 15:00:45 -05:00
parent e19e7d76fa
commit 74ac0d4c8c
5 changed files with 16 additions and 10 deletions

12
dist/scorm-again.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}