Constructor
new mw.guidedTour.StepBuilder(tour, stepSpec)
#
Constructs a StepBuilder
Parameters:
| Name | Type | Description |
|---|---|---|
tour |
mw.guidedTour.Tour | Tour the corresponding Step belongs to |
stepSpec |
Object | See {mw.guidedTour.TourBuilder#step} for details. |
Throws:
-
On invalid step name
Methods
back(backValue) → {mw.guidedTour.StepBuilder}staticchainable
#
Tell the step how to determine the back step Calling 'back' in the tour definition now automatically creates a back button if one isn't specified already.
Invalid values or return values from the callback (a step name that does not refer to a valid step, a StepBuilder that is not part of the same tour) will cause an mw.guidedTour.TourDefinitionError exception to be thrown when the step is requested.
Parameters:
| Name | Type | Description |
|---|---|---|
backValue |
mw.guidedTour.StepBuilder | string | function | Value used to determine the back step. Either:
|
Returns:
Throws:
-
If this direction callback has has already been set
Tell the step how to determine the back step Calling 'back' in the tour definition now automatically creates a back button if one isn't specified already.
next(nextValue) → {mw.guidedTour.StepBuilder}staticchainable
#
Tell the step how to determine the next step. Calling 'next' in the tour definition now automatically creates a next button if one isn't specified already.
Invalid values or return values from the callback (a step name that does not refer to a valid step, a StepBuilder that is not part of the same tour) will cause an mw.guidedTour.TourDefinitionError exception to be thrown when the step is requested.
Parameters:
| Name | Type | Description |
|---|---|---|
nextValue |
mw.guidedTour.StepBuilder | string | function | Value used to determine the next step. Either:
|
Returns:
Throws:
-
If this direction callback has has already been set
transition(callback) → {mw.guidedTour.StepBuilder}staticchainable
#
Tell the step what to do at possible transition points, such as when hooks and events that are being listened to fire.
The passed in callback is called to check whether the tour should move to a new step. The callback can return the step to move to, as a mw.guidedTour.StepBuilder or a step name. It may also return two special values:
- gt.TransitionAction.HIDE - Hides the tour, but keeps the stored user state
- gt.TransitionAction.END - Ends the tour, clearing the user state
The callback may also return nothing. In that case, it will not transition.
Invalid return values from the callback (a step name that does not refer to a valid step, a StepBuilder that is not part of the same tour, or a number that is not a valid TransitionAction) will cause a mw.guidedTour.TourDefinitionError exception to be thrown when the tour checks to see if it should transition.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function | Callback called to determine whether to transition, and if so what to do (either move to another step or do a TransitionAction) Properties:
|
Returns:
Throws:
-
If StepBuilder.transition() has already been called, or callback is not a function
Tell the step what to do at possible transition points, such as when hooks and events that are being listened to fire.