Loading static/js/state.mjs +4 −8 Changes for static/js/state.mjs: 4 added lines, 8 removed lines. Original line number Diff line number Diff line /** Read and modify the current state of the application. Allows saving to local storage. */ import { pooltest } from "./exercises.mjs" export const currentState = { /** Loading Loading @@ -46,9 +44,8 @@ export const currentState = { throw new Error("index must be a number") } if (index < 0 || index > pooltest.exercises.length) { throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) } // TODO Verify that index is in range, else // throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) localStorage.setItem("exerciseIndex", index) }, Loading Loading @@ -77,9 +74,8 @@ export const currentState = { throw new Error(`Can't solve the same exercise (${exerciseIndex}) twice`) } if (exerciseIndex < 0 || exerciseIndex > pooltest.exercises.length) { throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) } // TODO Verify that exerciseIndex is in range, else // throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) const newIndices = this.solvedExercises newIndices.push(exerciseIndex) Loading Loading
static/js/state.mjs +4 −8 Changes for static/js/state.mjs: 4 added lines, 8 removed lines. Original line number Diff line number Diff line /** Read and modify the current state of the application. Allows saving to local storage. */ import { pooltest } from "./exercises.mjs" export const currentState = { /** Loading Loading @@ -46,9 +44,8 @@ export const currentState = { throw new Error("index must be a number") } if (index < 0 || index > pooltest.exercises.length) { throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) } // TODO Verify that index is in range, else // throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) localStorage.setItem("exerciseIndex", index) }, Loading Loading @@ -77,9 +74,8 @@ export const currentState = { throw new Error(`Can't solve the same exercise (${exerciseIndex}) twice`) } if (exerciseIndex < 0 || exerciseIndex > pooltest.exercises.length) { throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) } // TODO Verify that exerciseIndex is in range, else // throw new Error(`Exercise index must be >= 0 and < exercises.length (${pooltest.exercises.length})`) const newIndices = this.solvedExercises newIndices.push(exerciseIndex) Loading