Storing data on terminate/finish and calling listeners for LMS sequencing

This commit is contained in:
Jonathan Putney
2019-11-19 12:16:31 -05:00
parent fa5f60401c
commit 1257df6d18
7 changed files with 111 additions and 54 deletions

View File

@@ -17,6 +17,7 @@ export default class BaseAPI {
autocommitSeconds: 60,
lmsCommitUrl: false,
dataCommitFormat: 'json', // valid formats are 'json' or 'flattened', 'params'
auto_progress: false,
};
cmi;
startingData: {};
@@ -103,6 +104,13 @@ export default class BaseAPI {
if (this.checkState(checkTerminated,
this.#error_codes.TERMINATION_BEFORE_INIT,
this.#error_codes.MULTIPLE_TERMINATION)) {
const result = this.storeData(true);
if (result.errorCode && result.errorCode > 0) {
this.throwSCORMError(result.errorCode);
}
returnValue = result.result ?
result.result : global_constants.SCORM_FALSE;
if (checkTerminated) this.lastErrorCode = 0;
this.currentState = global_constants.STATE_TERMINATED;
returnValue = global_constants.SCORM_TRUE;