Class: PageStateManager
@ima/core.PageStateManager
Manager of the current page state and state history.
Hierarchy
PageStateManager
Constructors
constructor
• new PageStateManager()
Properties
onChange
• Optional
onChange: (newState
: UnknownParameters
) => void
Type declaration
▸ (newState
): void
Parameters
Name | Type |
---|---|
newState | UnknownParameters |
Returns
void
Defined in
packages/core/src/page/state/PageStateManager.ts:9
Methods
beginTransaction
▸ beginTransaction(): void
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
Defined in
packages/core/src/page/state/PageStateManager.ts:66
cancelTransaction
▸ cancelTransaction(): void
Cancels ongoing transaction. Uncommitted state changes are lost.
Returns
void
Defined in
packages/core/src/page/state/PageStateManager.ts:81
clear
▸ clear(): void
Clears the state history.
Returns
void
Defined in
packages/core/src/page/state/PageStateManager.ts:14
commitTransaction
▸ commitTransaction(): void
Applies queued state patches to the main state. All patches are squashed
and applied with one setState
call.
Returns
void
Defined in
packages/core/src/page/state/PageStateManager.ts:74
getAllStates
▸ getAllStates(): UnknownParameters
[]
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
The recorded history of page states.
Defined in
packages/core/src/page/state/PageStateManager.ts:46
getState
▸ getState(): UnknownParameters
Returns the current page state.
Returns
The current page state.
Defined in
packages/core/src/page/state/PageStateManager.ts:33
getTransactionStatePatches
▸ getTransactionStatePatches(): UnknownParameters
[]
Returns queueing state patches off the main state from the begin of transaction.
Returns
State patches from the begin of transaction.
Defined in
packages/core/src/page/state/PageStateManager.ts:55
setState
▸ setState(statePatch
): void
Sets a new page state by applying the provided patch to the current state.
Parameters
Name | Type | Description |
---|---|---|
statePatch | UnknownParameters | The patch of the current state. |
Returns
void