travels3.0
API ReferenceInterfaces

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()

readonly back: (amount?) => void

Defined in: src/type.ts:432

Go back in the history

Parameters

amount?

number

Returns

void


canBack()

readonly canBack: () => boolean

Defined in: src/type.ts:448

Check if it's possible to go back

Returns

boolean


canForward()

readonly canForward: () => boolean

Defined in: src/type.ts:452

Check if it's possible to go forward

Returns

boolean


forward()

readonly forward: (amount?) => void

Defined in: src/type.ts:436

Go forward in the history

Parameters

amount?

number

Returns

void


getHistory()

readonly getHistory: () => readonly Immutable<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()

readonly getHistorySnapshot: () => S[]

Defined in: src/type.ts:419

Get fully detached history snapshots that the caller owns.

Returns

S[]


go()

readonly go: (position) => void

Defined in: src/type.ts:444

Go to a specific position in the history

Parameters

position

number

Returns

void


patches

readonly patches: 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

readonly position: number

Defined in: src/type.ts:407

The current position in the history


reset()

readonly reset: () => void

Defined in: src/type.ts:440

Reset the history

Returns

void

On this page