From 4410a4318365862ea17d4e78d232820ebc812dcd Mon Sep 17 00:00:00 2001 From: "Stefan@AWG" Date: Thu, 18 Jun 2020 20:00:07 +0200 Subject: [PATCH] debug(tutorials.js): log out any NaN calls to console This change adds a console log for any NaN values to improve debugging of #136. --- js/mei-tutorials.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/mei-tutorials.js b/js/mei-tutorials.js index bb1f343b..8e717db4 100644 --- a/js/mei-tutorials.js +++ b/js/mei-tutorials.js @@ -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); }); }