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

Method _setOptions

shepherd.js/src/step.ts:667–695  ·  view source on GitHub ↗

* Sets the options for the step, maps `when` to events, sets up buttons * @param options - The options for the step

(options: StepOptions = {})

Source from the content-addressed store, hash-verified

665 * @param options - The options for the step
666 */
667 _setOptions(options: StepOptions = {}) {
668 let tourOptions =
669 this.tour && this.tour.options && this.tour.options.defaultStepOptions;
670
671 tourOptions = deepmerge({}, tourOptions || {});
672
673 this.options = Object.assign(
674 {
675 arrow: true
676 },
677 tourOptions,
678 options,
679 mergeTooltipConfig(tourOptions, options)
680 );
681
682 const { when } = this.options;
683
684 this.options.classes = this._getClassOptions(options);
685
686 this.destroy();
687 this.id = this.options.id || `step-${uuid()}`;
688
689 if (when) {
690 Object.keys(when).forEach((event) => {
691 // @ts-expect-error TODO: fix this type error
692 this.on(event, when[event], this);
693 });
694 }
695 }
696
697 /**
698 * Create the element and set up the FloatingUI instance

Callers 1

constructorMethod · 0.95

Calls 5

_getClassOptionsMethod · 0.95
destroyMethod · 0.95
mergeTooltipConfigFunction · 0.90
uuidFunction · 0.90
onMethod · 0.80

Tested by

no test coverage detected