Skip to content

Commit

Permalink
debug(tutorials.js): log out any NaN calls to console
Browse files Browse the repository at this point in the history
This change adds a console log for any NaN values to improve debugging of music-encoding#136.
  • Loading branch information
musicEnfanthen committed Jun 18, 2020
1 parent 9333d9e commit 6ae2a4e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/mei-tutorials.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,18 @@ function setupTutorial(data) {
var stepNum = 0 ;

//start with the first step of the tutorial
loadTutorialStep(data,stepNum);
loadTutorialStep(data, stepNum);

//add listener to allow going to the next step
document.getElementById('nextStepButton').addEventListener('click',(e) => {
var stepNum = parseInt(e.target.getAttribute('data-stepnum'));
stepNum = parseInt(e.target.getAttribute('data-next-stepnum'), 10);

// load next step
//catch any non numbers
if (isNaN(stepNum)) {
console.log('error getting next step number: ', stepNum, 'for event: ', e);
}

//load next step
loadTutorialStep(data, stepNum);
});
}
Expand Down

0 comments on commit 6ae2a4e

Please sign in to comment.