MCPcopy
hub / github.com/shipshapecode/shepherd / removeStep

Method removeStep

shepherd.js/src/tour.ts:293–316  ·  view source on GitHub ↗

* Removes the step from the tour * @param {string} name - The id for the step to remove

(name: string)

Source from the content-addressed store, hash-verified

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

Callers 1

tour.spec.jsFile · 0.80

Calls 6

getCurrentStepMethod · 0.95
showMethod · 0.95
cancelMethod · 0.95
isOpenMethod · 0.80
destroyMethod · 0.80
hideMethod · 0.45

Tested by

no test coverage detected