Skip to main content

Class: PageStateManagerDecorator

@ima/core.PageStateManagerDecorator

Decorator for page state manager, which add logic for limiting Extension competence.

Hierarchy

Constructors

constructor

new PageStateManagerDecorator(pageStateManager, allowedStateKeys)

Initializes the page state manager decorator.

Parameters

NameType
pageStateManagerPageStateManager<{}>
allowedStateKeysstring[]

Overrides

PageStateManager.constructor

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
NameType
newStateObject
Returns

void

Inherited from

PageStateManager.onChange

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

PageStateManager.clear

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

PageStateManager.getAllStates

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

PageStateManager.getState

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

NameType
statePatchUnknownParameters

Returns

void

Overrides

PageStateManager.setState

Defined in

packages/core/src/page/state/PageStateManagerDecorator.ts:46