Skip to main content

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​

Constructor​

new PageStateManagerDecorator(pageStateManager, allowedStateKeys): PageStateManagerDecorator

Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:25

Initializes the page state manager decorator.

Parameters​

pageStateManager​

PageStateManager

allowedStateKeys​

string[]

Returns​

PageStateManagerDecorator

Overrides​

PageStateManager.constructor

Properties​

onChange()?​

optional onChange: (newState) => void

Defined in: packages/core/src/page/state/PageStateManager.ts:7

Parameters​

newState​

Returns​

void

Inherited from​

PageStateManager.onChange

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​

PageStateManager.clear


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​

PageStateManager.getAllStates


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​

PageStateManager.getState


getTransactionStatePatches()​

getTransactionStatePatches(): ({ } | Pick<{ }, any> | null)[]

Defined in: packages/core/src/page/state/PageStateManagerDecorator.ts:82

Returns queueing state patches off the main state from the begin of transaction.

Returns​

({ } | Pick<{ }, any> | null)[]

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​

UnknownParameters

Returns​

void

Overrides​

PageStateManager.setState