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

Function _setupAdvanceOnHandler

shepherd.js/src/utils/bind.ts:10–23  ·  view source on GitHub ↗

* Sets up the handler to determine if we should advance the tour * @param step The step instance * @param selector * @private

(step: Step, selector?: string)

Source from the content-addressed store, hash-verified

8 * @private
9 */
10function _setupAdvanceOnHandler(step: Step, selector?: string) {
11 return (event: Event) => {
12 if (step.isOpen()) {
13 const targetIsEl = step.el && event.currentTarget === step.el;
14 const targetIsSelector =
15 !isUndefined(selector) &&
16 (event.currentTarget as HTMLElement).matches(selector);
17
18 if (targetIsSelector || targetIsEl) {
19 step.tour.next();
20 }
21 }
22 };
23}
24
25/**
26 * Bind the event handler for advanceOn

Callers 1

bindAdvanceFunction · 0.85

Calls 3

isUndefinedFunction · 0.90
isOpenMethod · 0.80
nextMethod · 0.80

Tested by

no test coverage detected