* Adds a new step to the tour * @param {StepOptions} options - An object containing step options or a Step instance * @param {number | undefined} index - The optional index to insert the step at. If undefined, the step * is added to the end of the array. * @return The newly added step
(options: StepOptions | Step, index?: number)
| 163 | * @return The newly added step |
| 164 | */ |
| 165 | addStep(options: StepOptions | Step, index?: number) { |
| 166 | let step = options; |
| 167 | |
| 168 | if (!(step instanceof Step)) { |
| 169 | step = new Step(this, step); |
| 170 | } else { |
| 171 | step.tour = this; |
| 172 | } |
| 173 | |
| 174 | if (!isUndefined(index)) { |
| 175 | this.steps.splice(index, 0, step as Step); |
| 176 | } else { |
| 177 | this.steps.push(step as Step); |
| 178 | } |
| 179 | |
| 180 | return step; |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Add multiple steps to the tour |
no test coverage detected