TravelsControls<S, P>
Travels 3.0.1. Travels 3 API reference for TravelsControls.
Defined in: src/type.ts:403
Extended by
Type Parameters
S
S
P
P extends PatchesOption = { }
Properties
back()
readonlyback: (amount?) =>void
Defined in: src/type.ts:432
Go back in the history
Parameters
amount?
number
Returns
void
canBack()
readonlycanBack: () =>boolean
Defined in: src/type.ts:448
Check if it's possible to go back
Returns
boolean
canForward()
readonlycanForward: () =>boolean
Defined in: src/type.ts:452
Check if it's possible to go forward
Returns
boolean
forward()
readonlyforward: (amount?) =>void
Defined in: src/type.ts:436
Go forward in the history
Parameters
amount?
number
Returns
void
getHistory()
readonlygetHistory: () => readonlyImmutable<S>[]
Defined in: src/type.ts:415
Get the shared history cache.
Returns
readonly Immutable<S>[]
Remarks
The returned array is Travels' shared internal cache. Use getHistorySnapshot when you need an array you can keep or change.
getHistorySnapshot()
readonlygetHistorySnapshot: () =>S[]
Defined in: src/type.ts:419
Get fully detached history snapshots that the caller owns.
Returns
S[]
go()
readonlygo: (position) =>void
Defined in: src/type.ts:444
Go to a specific position in the history
Parameters
position
number
Returns
void
patches
readonlypatches:ReadonlyTravelPatches<P>
Defined in: src/type.ts:428
Shared read-only view of the retained patch history.
Remarks
The view is cached and keeps its reference until history changes, so it
is cheap to read during rendering. Use getPatches() on the timeline for
a detached, caller-owned copy.
position
readonlyposition:number
Defined in: src/type.ts:407
The current position in the history
reset()
readonlyreset: () =>void
Defined in: src/type.ts:440
Reset the history
Returns
void