* Show a specific step in the tour * @param {number | string} key - The key to look up the step by * @param {boolean} forward - True if we are going forward, false if backward
(key: number | string = 0, forward = true)
| 321 | * @param {boolean} forward - True if we are going forward, false if backward |
| 322 | */ |
| 323 | show(key: number | string = 0, forward = true) { |
| 324 | const step = isString(key) ? this.getById(key) : this.steps[key]; |
| 325 | |
| 326 | if (step) { |
| 327 | this._updateStateBeforeShow(); |
| 328 | |
| 329 | const shouldSkipStep = |
| 330 | isFunction(step.options.showOn) && !step.options.showOn(); |
| 331 | |
| 332 | // If `showOn` returns false, we want to skip the step, otherwise, show the step like normal |
| 333 | if (shouldSkipStep) { |
| 334 | this._skipStep(step, forward); |
| 335 | } else { |
| 336 | this.currentStep = step; |
| 337 | this.trigger('show', { |
| 338 | step, |
| 339 | previous: this.currentStep |
| 340 | }); |
| 341 | |
| 342 | step.show(); |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * Start the tour |
no test coverage detected