Skip to content

Commit

Permalink
Add getElement and getTarget methods to step (#996)
Browse files Browse the repository at this point in the history
Added getElement to Step class
Added getTarget to Step class
Added this context to Action callback typescript definition
  • Loading branch information
WORMSS authored Jun 8, 2020
1 parent ca1dd00 commit 954124e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/js/step.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,22 @@ export class Step extends Evented {
}
}

/**
* Returns the element for the step
* @return {HTMLElement|null|undefined} The element instance. undefined if it has never been shown, null if it has been destroyed
*/
getElement() {
return this.el;
}

/**
* Returns the target for the step
* @return {HTMLElement|null|undefined} The element instance. undefined if it has never been shown, null if query string has not been found
*/
getTarget() {
return this.target;
}

/**
* Creates Shepherd element for step based on options
*
Expand Down
14 changes: 13 additions & 1 deletion src/types/step.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ declare class Step extends Evented {
* @param {Step.StepOptions} options to be updated
*/
updateStepOptions(options: Step.StepOptions): void;

/**
* Returns the element for the step
* @return The element instance. undefined if it has never been shown, null if it has been destroyed
*/
getElement(): HTMLElement | null | undefined

/**
* Returns the target for the step
* @returns The element instance. undefined if it has never been shown, null if query string has not been found
*/
getTarget(): HTMLElement | null | undefined
}

declare namespace Step {
Expand Down Expand Up @@ -231,7 +243,7 @@ declare namespace Step {
* }
* ```
*/
action?: (() => void);
action?: ((this: Tour) => void);

/**
* Extra classes to apply to the `<a>`
Expand Down

0 comments on commit 954124e

Please sign in to comment.