Fixing eslint issues
This commit is contained in:
@@ -729,7 +729,7 @@ class ScheduledCommit {
|
|||||||
*/
|
*/
|
||||||
constructor(API: any, when: number) {
|
constructor(API: any, when: number) {
|
||||||
this.#API = API;
|
this.#API = API;
|
||||||
this.#timeout = setTimeout(this.#wrapper, when);
|
this.#timeout = setTimeout(this.wrapper, when);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -745,7 +745,7 @@ class ScheduledCommit {
|
|||||||
/**
|
/**
|
||||||
* Wrap the API commit call to check if the call has already been cancelled
|
* Wrap the API commit call to check if the call has already been cancelled
|
||||||
*/
|
*/
|
||||||
#wrapper() {
|
wrapper() {
|
||||||
if (!this.#cancelled) {
|
if (!this.#cancelled) {
|
||||||
this.#API.commit();
|
this.#API.commit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nodes.length > 0 && nodes.length <= response_type.max) {
|
if (nodes.length > 0 && nodes.length <= response_type.max) {
|
||||||
this.#checkCorrectResponseValue(interaction_type, nodes, value);
|
this.checkCorrectResponseValue(interaction_type, nodes, value);
|
||||||
} else if (nodes.length > response_type.max) {
|
} else if (nodes.length > response_type.max) {
|
||||||
this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,
|
this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,
|
||||||
'Data Model Element Pattern Too Long');
|
'Data Model Element Pattern Too Long');
|
||||||
@@ -227,7 +227,7 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nodes.length > 0 && nodes.length <= response_type.max) {
|
if (nodes.length > 0 && nodes.length <= response_type.max) {
|
||||||
this.#checkCorrectResponseValue(interaction_type, nodes, value);
|
this.checkCorrectResponseValue(interaction_type, nodes, value);
|
||||||
} else if (nodes.length > response_type.max) {
|
} else if (nodes.length > response_type.max) {
|
||||||
this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,
|
this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE,
|
||||||
'Data Model Element Pattern Too Long');
|
'Data Model Element Pattern Too Long');
|
||||||
@@ -235,7 +235,7 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
|
|
||||||
if (this.lastErrorCode === 0 &&
|
if (this.lastErrorCode === 0 &&
|
||||||
(!response_type.duplicate ||
|
(!response_type.duplicate ||
|
||||||
!this.#checkDuplicatedPattern(interaction.correct_responses,
|
!this.checkDuplicatedPattern(interaction.correct_responses,
|
||||||
pattern_index, value)) ||
|
pattern_index, value)) ||
|
||||||
(this.lastErrorCode === 0 && value === '')) {
|
(this.lastErrorCode === 0 && value === '')) {
|
||||||
// do nothing, we want the inverse
|
// do nothing, we want the inverse
|
||||||
@@ -289,7 +289,7 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
* @param {*} value
|
* @param {*} value
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
#checkDuplicatedPattern = (correct_response, current_index, value) => {
|
checkDuplicatedPattern = (correct_response, current_index, value) => {
|
||||||
let found = false;
|
let found = false;
|
||||||
const count = correct_response._count;
|
const count = correct_response._count;
|
||||||
for (let i = 0; i < count && !found; i++) {
|
for (let i = 0; i < count && !found; i++) {
|
||||||
@@ -306,13 +306,13 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
* @param {Array} nodes
|
* @param {Array} nodes
|
||||||
* @param {*} value
|
* @param {*} value
|
||||||
*/
|
*/
|
||||||
#checkCorrectResponseValue = (interaction_type, nodes, value) => {
|
checkCorrectResponseValue(interaction_type, nodes, value) {
|
||||||
const response = correct_responses[interaction_type];
|
const response = correct_responses[interaction_type];
|
||||||
const formatRegex = new RegExp(response.format);
|
const formatRegex = new RegExp(response.format);
|
||||||
for (let i = 0; i < nodes.length && this.lastErrorCode === 0; i++) {
|
for (let i = 0; i < nodes.length && this.lastErrorCode === 0; i++) {
|
||||||
if (interaction_type.match(
|
if (interaction_type.match(
|
||||||
'^(fill-in|long-fill-in|matching|performance|sequencing)$')) {
|
'^(fill-in|long-fill-in|matching|performance|sequencing)$')) {
|
||||||
nodes[i] = this.#removeCorrectResponsePrefixes(nodes[i]);
|
nodes[i] = this.removeCorrectResponsePrefixes(nodes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.delimiter2 !== undefined) {
|
if (response.delimiter2 !== undefined) {
|
||||||
@@ -351,14 +351,14 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove prefixes from correct_response
|
* Remove prefixes from correct_response
|
||||||
* @param {string} node
|
* @param {string} node
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
#removeCorrectResponsePrefixes = (node) => {
|
removeCorrectResponsePrefixes(node) {
|
||||||
let seenOrder = false;
|
let seenOrder = false;
|
||||||
let seenCase = false;
|
let seenCase = false;
|
||||||
let seenLang = false;
|
let seenLang = false;
|
||||||
@@ -407,7 +407,7 @@ export default class Scorm2004API extends BaseAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the whole API with another
|
* Replace the whole API with another
|
||||||
|
|||||||
@@ -1472,9 +1472,19 @@ class ADLNavRequestValid extends BaseCMI {
|
|||||||
#continue = 'unknown';
|
#continue = 'unknown';
|
||||||
#previous = 'unknown';
|
#previous = 'unknown';
|
||||||
choice = class {
|
choice = class {
|
||||||
|
/**
|
||||||
|
* Check if target is valid
|
||||||
|
* @param {*} _target
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
_isTargetValid = (_target) => 'unknown';
|
_isTargetValid = (_target) => 'unknown';
|
||||||
};
|
};
|
||||||
jump = class {
|
jump = class {
|
||||||
|
/**
|
||||||
|
* Check if target is valid
|
||||||
|
* @param {*} _target
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
_isTargetValid = (_target) => 'unknown';
|
_isTargetValid = (_target) => 'unknown';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user