travels3.0
API 参考接口

ManualTravelsControls<S, P>

Travels 3.0.1. Travels 3 API reference for ManualTravelsControls.

此页尚未提供中文译文。以下内容由英文源码注释生成,API 名称与签名保持原样。

Defined in: src/type.ts:470

Extends

Type Parameters

S

S

P

P extends PatchesOption = { }

Properties

archive()

readonly archive: (metadata?) => void

Defined in: src/type.ts:477

Archive the current state

Parameters

metadata?

TravelMetadata

Returns

void


back()

readonly back: (amount?) => void

Defined in: src/type.ts:432

Go back in the history

Parameters

amount?

number

Returns

void

Inherited from

TravelsControls.back


canArchive()

readonly canArchive: () => boolean

Defined in: src/type.ts:481

Check if it's possible to archive the current state

Returns

boolean


canBack()

readonly canBack: () => boolean

Defined in: src/type.ts:448

Check if it's possible to go back

Returns

boolean

Inherited from

TravelsControls.canBack


canForward()

readonly canForward: () => boolean

Defined in: src/type.ts:452

Check if it's possible to go forward

Returns

boolean

Inherited from

TravelsControls.canForward


forward()

readonly forward: (amount?) => void

Defined in: src/type.ts:436

Go forward in the history

Parameters

amount?

number

Returns

void

Inherited from

TravelsControls.forward


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.

Inherited from

TravelsControls.getHistory


getHistorySnapshot()

readonly getHistorySnapshot: () => S[]

Defined in: src/type.ts:419

Get fully detached history snapshots that the caller owns.

Returns

S[]

Inherited from

TravelsControls.getHistorySnapshot


go()

readonly go: (position) => void

Defined in: src/type.ts:444

Go to a specific position in the history

Parameters

position

number

Returns

void

Inherited from

TravelsControls.go


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.

Inherited from

TravelsControls.patches


position

readonly position: number

Defined in: src/type.ts:407

The current position in the history

Inherited from

TravelsControls.position


reset()

readonly reset: () => void

Defined in: src/type.ts:440

Reset the history

Returns

void

Inherited from

TravelsControls.reset

本页目录