[IMP] tour.js: add return when calling error to stop the tour.

This commit is contained in:
Christophe Matthieu 2014-07-02 17:06:25 +02:00
parent 36d8954d87
commit 0c1489e8bd
1 changed files with 5 additions and 5 deletions

View File

@ -73,13 +73,13 @@ var Tour = {
run: function (tour_id, mode) {
var tour = Tour.tours[tour_id];
if (!tour) {
Tour.error(null, "Can't run '"+tour_id+"' (tour undefined)");
return Tour.error(null, "Can't run '"+tour_id+"' (tour undefined)");
}
console.log("Tour '"+tour_id+"' Begin from run method");
var state = Tour.getState();
if (state) {
if (state.mode === "test") {
Tour.error(false, "An other running tour has been detected all tours are now killed.");
return Tour.error(false, "An other running tour has been detected all tours are now killed.");
} else {
Tour.endTour();
}
@ -381,7 +381,7 @@ var Tour = {
Tour.nextStep();
} else {
if (state.mode === "test" && state.wait >= 10) {
Tour.error(state.step, "Tour '"+state.id+"' undefined");
return Tour.error(state.step, "Tour '"+state.id+"' undefined");
}
Tour.saveState(state.id, state.mode, state.step_id, state.number-1, state.wait+1);
console.log("Tour '"+state.id+"' wait for running (tour undefined)");
@ -422,7 +422,7 @@ var Tour = {
} else if (!overlaps || new Date().getTime() - time < overlaps) {
Tour.timer = setTimeout(checkNext, Tour.defaultDelay);
} else {
Tour.error(next, "Can't reach the next step");
return Tour.error(next, "Can't reach the next step");
}
}
checkNext();
@ -438,7 +438,7 @@ var Tour = {
var next = state.tour.steps[step.id+1];
if (state.mode === "test" && state.number > 3) {
Tour.error(next, "Cycling. Can't reach the next step");
return Tour.error(next, "Cycling. Can't reach the next step");
}
Tour.saveState(state.id, state.mode, step.id, state.number);