* Removes the step from the tour * @param {string} name - The id for the step to remove
(name: string)
| 291 | * @param {string} name - The id for the step to remove |
| 292 | */ |
| 293 | removeStep(name: string) { |
| 294 | const current = this.getCurrentStep(); |
| 295 | |
| 296 | // Find the step, destroy it and remove it from this.steps |
| 297 | this.steps.some((step, i) => { |
| 298 | if (step.id === name) { |
| 299 | if (step.isOpen()) { |
| 300 | step.hide(); |
| 301 | } |
| 302 | |
| 303 | step.destroy(); |
| 304 | this.steps.splice(i, 1); |
| 305 | |
| 306 | return true; |
| 307 | } |
| 308 | }); |
| 309 | |
| 310 | if (current && current.id === name) { |
| 311 | this.currentStep = undefined; |
| 312 | |
| 313 | // If we have steps left, show the first one, otherwise just cancel the tour |
| 314 | this.steps.length ? this.show(0) : this.cancel(); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Show a specific step in the tour |
no test coverage detected