Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Add error callback for showStep (Issue #274) (#291)
Browse files Browse the repository at this point in the history
* Add error callback for showStep

Calling showStep without a proper step target fails, but the tour error
callback is not invoked. This change fixes that, and sets the current
step number to the step that failed for debugging purposes

* Revert step num after error callback

Not sure if this will work

* remove all stepNum stuff, see if it still breaks

just a test to see what's breaking

* Add templates stuff

* Revert "Add templates stuff"

This reverts commit 8dfed46.

* Resubmit error callback patch

temporarily set currStepNum then revert

* deglobalizing temporary var

* Hoist temp var to top of function
  • Loading branch information
travstone authored and timlindvall committed Jun 26, 2016
1 parent 3557d2e commit 31d8f5f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/hopscotch.js
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,12 @@
* @returns {Object} Hopscotch
*/
this.showStep = function(stepNum) {
var step = currTour.steps[stepNum];
var step = currTour.steps[stepNum],
prevStepNum = currStepNum;
if(!utils.getStepTarget(step)) {
currStepNum = stepNum;
utils.invokeEventCallbacks('error');
currStepNum = prevStepNum;
return;
}

Expand Down

0 comments on commit 31d8f5f

Please sign in to comment.