Class: PageStateManagerDecorator
@ima/core.PageStateManagerDecorator
Decorator for page state manager, which add logic for limiting Extension competence.
Hierarchy
↳
PageStateManagerDecorator
Constructors
constructor
• new PageStateManagerDecorator(pageStateManager
, allowedStateKeys
)
Initializes the page state manager decorator.
Parameters
Name | Type |
---|---|
pageStateManager | PageStateManager <{}> |
allowedStateKeys | string [] |
Overrides
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:25
Properties
_allowedStateKeys
• Private
_allowedStateKeys: string
[]
Array of access keys for state.
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:17
_pageStateManager
• Private
_pageStateManager: PageStateManager
<{}>
The current page state manager.
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:13
onChange
• Optional
onChange: (newState
: {}) => void
Type declaration
▸ (newState
): void
Parameters
Name | Type |
---|---|
newState | Object |
Returns
void
Inherited from
Defined in
packages/core/src/page/state/PageStateManager.ts:7
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
Overrides
PageStateManager.beginTransaction
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:89
cancelTransaction
▸ cancelTransaction(): void
Cancels ongoing transaction. Uncommitted state changes are lost.
Returns
void
Overrides
PageStateManager.cancelTransaction
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:103
clear
▸ clear(): void
Clears the state history.
Returns
void
Overrides
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:39
commitTransaction
▸ commitTransaction(): void
Applies queued state patches to the main state. All patches are squashed
and applied with one setState
call.
Returns
void
Overrides
PageStateManager.commitTransaction
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:96
getAllStates
▸ getAllStates(): {}[]
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.
Overrides
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:75
getState
▸ getState(): Object
Returns the current page state.
Returns
Object
The current page state.
Overrides
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:68
getTransactionStatePatches
▸ getTransactionStatePatches(): (null
| {} | Pick
<{}, any
>)[]
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
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:82
setState
▸ setState(statePatch
): void
Sets a new page state by applying the provided patch to the current state.
Parameters
Name | Type |
---|---|
statePatch | UnknownParameters |
Returns
void
Overrides
Defined in
packages/core/src/page/state/PageStateManagerDecorator.ts:46