Class: abstract
PageStateManager<S>
Defined in: packages/core/src/page/state/PageStateManager.ts:6
Manager of the current page state and state history.
Extended by
Type Parameters
• S extends PageState
= {}
Constructors
new PageStateManager()
new PageStateManager<
S
>():PageStateManager
<S
>
Returns
Properties
onChange()?
optional
onChange: (newState
) =>void
Defined in: packages/core/src/page/state/PageStateManager.ts:7
Parameters
newState
S
Returns
void
Methods
beginTransaction()
beginTransaction():
void
Defined in: packages/core/src/page/state/PageStateManager.ts:64
Starts queueing state patches off the main state. While the transaction
is active every setState
call has no effect on the current state.
Note that call to getState
after the transaction has begun will
return state as it was before the transaction.
Returns
void
cancelTransaction()
cancelTransaction():
void
Defined in: packages/core/src/page/state/PageStateManager.ts:79
Cancels ongoing transaction. Uncommitted state changes are lost.
Returns
void
clear()
clear():
void
Defined in: packages/core/src/page/state/PageStateManager.ts:12
Clears the state history.
Returns
void
commitTransaction()
commitTransaction():
void
Defined in: packages/core/src/page/state/PageStateManager.ts:72
Applies queued state patches to the main state. All patches are squashed
and applied with one setState
call.
Returns
void
getAllStates()
getAllStates():
S
[]
Defined in: packages/core/src/page/state/PageStateManager.ts:44
Returns the recorded history of page states. The states will be chronologically sorted from the oldest to the newest.
Note that the implementation may limit the size of the recorded history, therefore the complete history may not be available.
Returns
S
[]
The recorded history of page states.
getState()
getState():
S
Defined in: packages/core/src/page/state/PageStateManager.ts:31
Returns the current page state.
Returns
S
The current page state.
getTransactionStatePatches()
getTransactionStatePatches(): (
null
|S
|Pick
<S
,any
>)[]
Defined in: packages/core/src/page/state/PageStateManager.ts:53
Returns queueing state patches off the main state from the begin of transaction.
Returns
(null
| S
| Pick
<S
, any
>)[]
State patches from the begin of transaction.
setState()
setState<
K
>(patchState
):void
Defined in: packages/core/src/page/state/PageStateManager.ts:22
Sets a new page state by applying the provided patch to the current state.
Type Parameters
• K extends string
| number
| symbol
Parameters
patchState
null
| S
| Pick
<S
, K
>
Returns
void