TourItem
@dopt/javascript / Exports / TourItem
Class: TourItem
Hierarchy
Block
<["next"
,"previous"
]>↳
TourItem
Implements
TourItem
Table of contents
Accessors
Methods
Accessors
id
• get
id(): string
Returns
string
Implementation of
TourItemInterface.id
Defined in
packages/@dopt/javascript/src/tour.ts:90
active
• get
active(): boolean
Returns
boolean
Implementation of
TourItemInterface.active
Defined in
packages/@dopt/javascript/src/tour.ts:93
completed
• get
completed(): boolean
Returns
boolean
Implementation of
TourItemInterface.completed
Defined in
packages/@dopt/javascript/src/tour.ts:96
tour
• get
tour(): undefined
| Tour
Returns
undefined
| Tour
Implementation of
TourItemInterface.tour
Defined in
packages/@dopt/javascript/src/tour.ts:99
nextLabel
• get
nextLabel(): undefined
| null
| string
Returns
undefined
| null
| string
Implementation of
TourItemInterface.nextLabel
Defined in
packages/@dopt/javascript/src/tour.ts:108
backLabel
• get
backLabel(): undefined
| null
| string
Returns
undefined
| null
| string
Implementation of
TourItemInterface.backLabel
Defined in
packages/@dopt/javascript/src/tour.ts:111
title
• get
title(): undefined
| null
| string
Returns
undefined
| null
| string
Implementation of
TourItemInterface.title
Defined in
packages/@dopt/javascript/src/tour.ts:114
body
• get
body(): undefined
| null
| Children
Returns
undefined
| null
| Children
Implementation of
TourItemInterface.body
Defined in
packages/@dopt/javascript/src/tour.ts:117
index
• get
index(): undefined
| null
| number
Returns
undefined
| null
| number
Implementation of
TourItemInterface.index
Defined in
packages/@dopt/javascript/src/tour.ts:120
type
• get
type(): "custom"
| "card"
| "modal"
| "checklist"
| "checklistItem"
| "tour"
| "tourItem"
Returns
"custom"
| "card"
| "modal"
| "checklist"
| "checklistItem"
| "tour"
| "tourItem"
Inherited from
Block.type
Defined in
packages/@dopt/javascript/src/block.ts:91
kind
• get
kind(): "block"
Returns
"block"
Inherited from
Block.kind
Defined in
packages/@dopt/javascript/src/block.ts:95
sid
• get
sid(): string
Returns
string
Inherited from
Block.sid
Defined in
packages/@dopt/javascript/src/block.ts:99
uid
• get
uid(): string
Returns
string
Inherited from
Block.uid
Defined in
packages/@dopt/javascript/src/block.ts:103
version
• get
version(): number
Returns
number
Inherited from
Block.version
Defined in
packages/@dopt/javascript/src/block.ts:107
state
• get
state(): Object
Returns the up-to-date state of this Block instance.
Returns
Object
The state of this instance.
Name | Type |
---|---|
active | boolean |
entered | boolean |
exited | boolean |
Inherited from
Block.state
Defined in
packages/@dopt/javascript/src/block.ts:116
transitioned
• get
transitioned(): T
extends [string
, ...string[]] ? Record
<T
[number
], undefined
| boolean
> : Record
<string
, undefined
| boolean
>
Returns the up-to-date transitioned values for this Block instance.
Example
const block = dopt.block("HNWvcT78tyTwygnbzU6SW");
const firstTransitioned = block.transitioned['first-edge'];
In typescript, if a block is accessed with generics:
const block = dopt.block<['a-edge']>("HNWvcT78tyTwygnbzU6SW");
// this is valid
block.transitioned['a-edge'];
// this is invalid
block.transitioned['b-edge'];
Returns
T
extends [string
, ...string[]] ? Record
<T
[number
], undefined
| boolean
> : Record
<string
, undefined
| boolean
>
The edges which have been transitioned for this instance. If the edge exists, it's value will be true / false, otherwise the value will be undefined.
Inherited from
Block.transitioned
Defined in
packages/@dopt/javascript/src/block.ts:143
Methods
next
▸ next(): void
Returns
void
Implementation of
TourItemInterface.next
Defined in
packages/@dopt/javascript/src/tour.ts:102
back
▸ back(): void
Returns
void
Implementation of
TourItemInterface.back
Defined in
packages/@dopt/javascript/src/tour.ts:105
field
▸ field<V
>(name
): undefined
| null
| V
Gets the field with the name
contained by this Block.
If Dopt is loading or Block does not have a field
with the specified name, undefined
is returned.
null
is returned when the field has been explicitly
configured in app.dopt.com to have an empty value.
Type parameters
Name | Type |
---|---|
V | extends null | string | number | boolean | Record <string , any >[] |
Parameters
Name | Type |
---|---|
name | string |
Returns
undefined
| null
| V
Inherited from
Defined in
packages/@dopt/javascript/src/block.ts:68
transition
▸ transition(...input
): void
Transition this block. Will also update the state of blocks within this flow, as appropriate. This function must be called with at least one transition.
Example
const block = dopt.block("HNWvcT78tyTwygnbzU6SW");
// transitioning a single edge
block.transition('first-edge');
// transitioning multiple edges
block.transition('second-edge', 'third-edge');
In typescript, if a block is accessed with generics:
const block = dopt.block<['a-edge']>("HNWvcT78tyTwygnbzU6SW");
// this is valid
block.transition('a-edge');
// this is invalid
block.transition('b-edge');
Remarks
This function will update state with Dopt and trigger changes. Subscribe to the flows and blocks you care about to react to those changes.
Parameters
Name | Type |
---|---|
...input | ["next" | "previous" , ...("next" | "previous")[]] |
Returns
void
void
Inherited from
Defined in
packages/@dopt/javascript/src/block.ts:181
subscribe
▸ subscribe(listener
): () => void
Subscribe to changes on this block.
Example
const block = dopt.block("HNWvcT78tyTwygnbzU6SW");
const unsubscribe = block.subscribe(async (block: Block) => {
if (block.state.exited) {
await showModal("Yay, you've completed your first step!");
unsubscribe();
}
});
Parameters
Name | Type | Description |
---|---|---|
listener | (block : Block <["next" , "previous" ]>) => void | The listener function is called with this Block instance. |
Returns
fn
A function which can be called to unsubscribe the listener.
▸ (): void
Returns
void