buffgym: Code style vs linter
Pass redraw as parameter to Workout, instead of using global variable. Make code to honor eslint linebreak-style (use Windows linebreak). Change eslintrc indent rule to match code style. Add missing semicolons.master
parent
0bacb71bbd
commit
9e69fd2e74
|
|
@ -15,7 +15,8 @@
|
|||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
2
|
||||
2,
|
||||
{ "SwitchCase": 1 }
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
|
|
|
|||
|
|
@ -150,4 +150,4 @@ exports = class Exercise {
|
|||
|
||||
workout.emit("redraw");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1 +1 @@
|
|||
require("heatshrink").decompress(atob("mEwxH+ACPI5AUSADAtB5vNGFQtBAIfNF95hoF4wwoF5AwmF5BhmXYbAEF/6QbF1QwIF04qB54ADAwIwoF4oRKBoIvsB4gvZ58kkgCDFxoxaF5wuHGDQcMF5IwXDZwLDGDmlDIWlkgJDSwIABCRAwPDQohCFgIABDQIOCFwYABr4RCCQIvQDYguEAAwtFF5owJDZAvHFw4vFOYQvKFAowMBxIvFMQwvPAB4wFUQ4vJGDYvUGC4vNdgyuEGDIsNFwYwGNAgAPExAvMGIdfTIovfTpYvrfRCOkZ44ugF44NGF05gUFyQvKGIoueGKIufGJ4uhG5oupGItfr4vvAAgvlGAQvt/wrEF9oEGF841IF9QGHX0oGIAD8kAAYJOFzwEBBQoMFACA="))
|
||||
require("heatshrink").decompress(atob("mEwxH+ACPI5AUSADAtB5vNGFQtBAIfNF95hoF4wwoF5AwmF5BhmXYbAEF/6QbF1QwIF04qB54ADAwIwoF4oRKBoIvsB4gvZ58kkgCDFxoxaF5wuHGDQcMF5IwXDZwLDGDmlDIWlkgJDSwIABCRAwPDQohCFgIABDQIOCFwYABr4RCCQIvQDYguEAAwtFF5owJDZAvHFw4vFOYQvKFAowMBxIvFMQwvPAB4wFUQ4vJGDYvUGC4vNdgyuEGDIsNFwYwGNAgAPExAvMGIdfTIovfTpYvrfRCOkZ44ugF44NGF05gUFyQvKGIoueGKIufGJ4uhG5oupGItfr4vvAAgvlGAQvt/wrEF9oEGF841IF9QGHX0oGIAD8kAAYJOFzwEBBQoMFACA="));
|
||||
|
|
|
|||
|
|
@ -25,4 +25,4 @@ exports = class Set {
|
|||
if (this.reps <= this.minReps) return;
|
||||
this.reps--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -3,7 +3,7 @@ exports = class Workout {
|
|||
this.title = params.title;
|
||||
this.exercises = [];
|
||||
this.completed = false;
|
||||
this.on("redraw", redraw.bind(null, this));
|
||||
this.on("redraw", params.redraw.bind(null, this));
|
||||
}
|
||||
|
||||
addExercises(exercises) {
|
||||
|
|
@ -27,11 +27,12 @@ exports = class Workout {
|
|||
return !!this.completed;
|
||||
}
|
||||
|
||||
static fromJSON(workoutJSON) {
|
||||
static fromJSON(workoutJSON, redraw) {
|
||||
const Set = require("buffgym-set.js");
|
||||
const Exercise = require("buffgym-exercise.js");
|
||||
const workout = new this({
|
||||
title: workoutJSON.title,
|
||||
redraw: redraw,
|
||||
});
|
||||
const exercises = workoutJSON.exercises.map(exerciseJSON => {
|
||||
const exercise = new Exercise({
|
||||
|
|
@ -80,4 +81,4 @@ exports = class Workout {
|
|||
// Call current exercise state machine
|
||||
this.currentExercise().next(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -248,7 +248,7 @@ function getWorkoutIndex() {
|
|||
function buildWorkout(fName) {
|
||||
const Workout = require("buffgym-workout.js");
|
||||
const workoutJSON = require("Storage").readJSON(fName);
|
||||
const workout = Workout.fromJSON(workoutJSON);
|
||||
const workout = Workout.fromJSON(workoutJSON, redraw);
|
||||
|
||||
return workout;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue