Class: PageStateManagerDecorator
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:9
Decorator for page state manager, which add logic for limiting Extension competence.
Extends
Constructors
new PageStateManagerDecorator()
new PageStateManagerDecorator(
pageStateManager
,allowedStateKeys
):PageStateManagerDecorator
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:25
Initializes the page state manager decorator.
Parameters
pageStateManager
allowedStateKeys
string
[]
Returns
Overrides
Properties
onChange()?
optional
onChange: (newState
) =>void
Defined in: packages/core/src/page/state/PageStateManager.ts:7
Parameters
newState
Returns
void
Inherited from
Methods
beginTransaction()
beginTransaction():
void
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:89
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
Overrides
PageStateManager
.beginTransaction
cancelTransaction()
cancelTransaction():
void
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:103
Cancels ongoing transaction. Uncommitted state changes are lost.
Returns
void
Overrides
PageStateManager
.cancelTransaction
clear()
clear():
void
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:39
Clears the state history.
Returns
void
Overrides
commitTransaction()
commitTransaction():
void
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:96
Applies queued state patches to the main state. All patches are squashed
and applied with one setState
call.
Returns
void
Overrides
PageStateManager
.commitTransaction
getAllStates()
getAllStates():
object
[]
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:75
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
object
[]
The recorded history of page states.
Overrides
getState()
getState():
object
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:68
Returns the current page state.
Returns
object
The current page state.
Overrides
getTransactionStatePatches()
getTransactionStatePatches(): (
null
| {} |Pick
<{},any
>)[]
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:82
Returns queueing state patches off the main state from the begin of transaction.
Returns
(null
| {} | Pick
<{}, any
>)[]
State patches from the begin of transaction.
Overrides
PageStateManager
.getTransactionStatePatches
setState()
setState(
statePatch
):void
Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:46
Sets a new page state by applying the provided patch to the current state.
Parameters
statePatch
Returns
void