Skip to content

Conversation

@danielgindi
Copy link
Contributor

added "close-button" exit reason
onFinish/onStep callbacks (onStart is not always enough),
and cleanupElement complementing the existing prepareElement

added "close-button" exit reason
`onFinish`/`onStep` callbacks (`onStart` is not always enough)
and `cleanupElement` complementing the existing `prepareElement`
@josias-r josias-r self-assigned this Aug 14, 2025
@josias-r
Copy link
Owner

@danielgindi Thanks again for this contribution. Could you elaborate what the use case here is, why the existing callbacks did not suffice?

@danielgindi
Copy link
Contributor Author

danielgindi commented Aug 14, 2025

@danielgindi Thanks again for this contribution. Could you elaborate what the use case here is, why the existing callbacks did not suffice?

Hi again!

Well I had some preparation needed for an element, that needs to be reversed when leaving that element. Unfortunately, the existing callbacks will require me to manage this in the "next" of the previous element, and the "prev" of the next element, as the user has multiple ways to navigate to the same step.
And if you'll decide to implement a timeline in the future, with clickable dots/steps- that would be even more problematic.

Also if I want to track the current step number, without adding a next+prev callback to every step, considering onStart etc, then onStep provides the solution.

I needed onFinish too, to determine whether the onboarding tutorial was terminated prematurely, or completed, to record that in the user's profile and act accordingly.

I started by overriding the prototype, adding Promise based callbacks in all of those points, but then decided to do it your way with the continue mechanism, and send a PR so everyone could enjoy. Improvements, simplification, and optional Promise support could be done later.

@josias-r

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants