From 08737afe1a9c5d9a29e0d89c4bf9713339db2ad6 Mon Sep 17 00:00:00 2001 From: Jonathan Putney Date: Tue, 12 Nov 2019 11:26:56 -0500 Subject: [PATCH] Fixing eslint issues --- src/BaseAPI.js | 4 ++-- src/Scorm2004API.js | 18 +++++++++--------- src/cmi/scorm2004_cmi.js | 10 ++++++++++ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/BaseAPI.js b/src/BaseAPI.js index 539973c..503f039 100644 --- a/src/BaseAPI.js +++ b/src/BaseAPI.js @@ -729,7 +729,7 @@ class ScheduledCommit { */ constructor(API: any, when: number) { 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 */ - #wrapper() { + wrapper() { if (!this.#cancelled) { this.#API.commit(); } diff --git a/src/Scorm2004API.js b/src/Scorm2004API.js index 3b2c1dd..7f48040 100644 --- a/src/Scorm2004API.js +++ b/src/Scorm2004API.js @@ -172,7 +172,7 @@ export default class Scorm2004API extends BaseAPI { } 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) { this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE, '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) { - this.#checkCorrectResponseValue(interaction_type, nodes, value); + this.checkCorrectResponseValue(interaction_type, nodes, value); } else if (nodes.length > response_type.max) { this.throwSCORMError(scorm2004_error_codes.GENERAL_SET_FAILURE, 'Data Model Element Pattern Too Long'); @@ -235,7 +235,7 @@ export default class Scorm2004API extends BaseAPI { if (this.lastErrorCode === 0 && (!response_type.duplicate || - !this.#checkDuplicatedPattern(interaction.correct_responses, + !this.checkDuplicatedPattern(interaction.correct_responses, pattern_index, value)) || (this.lastErrorCode === 0 && value === '')) { // do nothing, we want the inverse @@ -289,7 +289,7 @@ export default class Scorm2004API extends BaseAPI { * @param {*} value * @return {boolean} */ - #checkDuplicatedPattern = (correct_response, current_index, value) => { + checkDuplicatedPattern = (correct_response, current_index, value) => { let found = false; const count = correct_response._count; for (let i = 0; i < count && !found; i++) { @@ -306,13 +306,13 @@ export default class Scorm2004API extends BaseAPI { * @param {Array} nodes * @param {*} value */ - #checkCorrectResponseValue = (interaction_type, nodes, value) => { + checkCorrectResponseValue(interaction_type, nodes, value) { const response = correct_responses[interaction_type]; const formatRegex = new RegExp(response.format); for (let i = 0; i < nodes.length && this.lastErrorCode === 0; i++) { if (interaction_type.match( '^(fill-in|long-fill-in|matching|performance|sequencing)$')) { - nodes[i] = this.#removeCorrectResponsePrefixes(nodes[i]); + nodes[i] = this.removeCorrectResponsePrefixes(nodes[i]); } if (response.delimiter2 !== undefined) { @@ -351,14 +351,14 @@ export default class Scorm2004API extends BaseAPI { } } } - }; + } /** * Remove prefixes from correct_response * @param {string} node * @return {*} */ - #removeCorrectResponsePrefixes = (node) => { + removeCorrectResponsePrefixes(node) { let seenOrder = false; let seenCase = false; let seenLang = false; @@ -407,7 +407,7 @@ export default class Scorm2004API extends BaseAPI { } return node; - }; + } /** * Replace the whole API with another diff --git a/src/cmi/scorm2004_cmi.js b/src/cmi/scorm2004_cmi.js index e429854..210147a 100644 --- a/src/cmi/scorm2004_cmi.js +++ b/src/cmi/scorm2004_cmi.js @@ -1472,9 +1472,19 @@ class ADLNavRequestValid extends BaseCMI { #continue = 'unknown'; #previous = 'unknown'; choice = class { + /** + * Check if target is valid + * @param {*} _target + * @return {string} + */ _isTargetValid = (_target) => 'unknown'; }; jump = class { + /** + * Check if target is valid + * @param {*} _target + * @return {string} + */ _isTargetValid = (_target) => 'unknown'; };