Skip to main content

Class: AbstractPageManager

@ima/core.AbstractPageManager

Page manager for controller.

Hierarchy

Constructors

constructor

new AbstractPageManager(pageFactory, pageRenderer, pageStateManager, pageHandlerRegistry, dispatcher)

Initializes the page manager.

Parameters

NameTypeDescription
pageFactoryPageFactoryFactory used by the page manager to create instances of the controller for the current route, and decorate the controllers and page state managers.
pageRendererPageRendererThe current renderer of the page.
pageStateManagerPageStateManager<{}>The current page state manager.
pageHandlerRegistryPageHandlerRegistryInstance of HandlerRegistry that holds a list of pre-manage and post-manage handlers.
dispatcherDispatcher-

Overrides

PageManager.constructor

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:95

Properties

_dispatcher

Protected _dispatcher: Dispatcher

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:81


_managedPage

Protected _managedPage: ManagedPage

Details of the currently managed page.

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:68


_pageFactory

Protected _pageFactory: PageFactory

Factory used by the page manager to create instances of the controller for the current route, and decorate the controllers and page state managers.

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:63


_pageHandlerRegistry

Protected _pageHandlerRegistry: PageHandlerRegistry

A registry that holds a list of pre-manage and post-manage handlers.

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:80


_pageRenderer

Protected _pageRenderer: PageRenderer

The current renderer of the page.

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:72


_pageStateManager

Protected _pageStateManager: PageStateManager<{}>

The current page state manager.

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:76


_previousManagedPage

Protected _previousManagedPage: ManagedPage

Snapshot of the previously managed page before it was replaced with a new one

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:57

Methods

#cancelable

Private #cancelable<T>(promise): Promise<T>

Type parameters

Name
T

Parameters

NameType
promiseT

Returns

Promise<T>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:849


_activateController

Protected _activateController(): Promise<void>

Activate managed instance of controller.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:553


_activateExtensions

Protected _activateExtensions(): Promise<void>

Activate extensions for managed instance of controller.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:567


_activatePageSource

Protected _activatePageSource(): Promise<void>

Activate page source so call activate method on controller and his extensions.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:533


_clearComponentState

_clearComponentState(options): void

The method clear state on current rendered component to DOM.

Parameters

NameTypeDescription
optionsRouteOptionsThe current route options.

Returns

void

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:757


_constructManagedPageValue

Protected _constructManagedPageValue(controller, view, route, options, params, controllerInstance, decoratedController, viewInstance): ManagedPage

Parameters

NameType
controllerRouteController
viewunknown
routeAbstractRoute<string | RoutePathExpression>
optionsRouteOptions
paramsRouteParams
controllerInstanceController<PageState, RouteParams, PageState>
decoratedControllerControllerDecorator<{}, {}, {}>
viewInstanceunknown

Returns

ManagedPage

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:249


_deactivateController

Protected _deactivateController(): Promise<void>

Deactivate last managed instance of controller only If controller was activated.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:695


_deactivateExtensions

Protected _deactivateExtensions(): Promise<void>

Deactivate extensions for last managed instance of controller only if they were activated.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:706


_deactivatePageSource

Protected _deactivatePageSource(): Promise<void>

Deactivate page source so call deactivate method on controller and his extensions.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:681


_destroyController

Protected _destroyController(): Promise<void>

Destroy last managed instance of controller.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:730


_destroyExtensions

Protected _destroyExtensions(): Promise<void>

Destroy extensions for last managed instance of controller.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:743


_destroyPageSource

Protected _destroyPageSource(): Promise<void>

Destroy page source so call destroy method on controller and his extensions.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:718


_getInitialManagedPage

Protected _getInitialManagedPage(): ManagedPage

Clear value from managed page.

Returns

ManagedPage

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:306


_getLoadedControllerState

Protected _getLoadedControllerState(): Promise<{}>

Load controller state from managed instance of controller.

Returns

Promise<{}>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:489


_getLoadedExtensionsState

Protected _getLoadedExtensionsState(controllerState?): Promise<UnknownParameters>

Load extensions state from managed instance of controller.

Parameters

NameType
controllerState?UnknownParameters

Returns

Promise<UnknownParameters>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:505


_getUpdatedControllerState

Protected _getUpdatedControllerState(): {} | Promise<{}>

Return updated controller state for current page controller.

Returns

{} | Promise<{}>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:625


_getUpdatedExtensionsState

Protected _getUpdatedExtensionsState(controllerState?): Promise<UnknownParameters>

Return updated extensions state for current page controller.

Parameters

NameType
controllerState?UnknownParameters

Returns

Promise<UnknownParameters>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:641


_hasOnlyUpdate

Protected _hasOnlyUpdate(controller, view, options): boolean

Return true if manager has to update last managed controller and view.

Parameters

NameType
controllerRouteController
viewunknown
optionsRouteOptions

Returns

boolean

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:773


_initController

Protected _initController(): Promise<void>

Initializes managed instance of controller with the provided parameters.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:402


_initExtensions

Protected _initExtensions(): Promise<void>

Initialize extensions for managed instance of controller with the provided parameters.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:417


_initPageSource

Protected _initPageSource(): Promise<void>

Initialize page source so call init method on controller and his extensions.

Returns

Promise<void>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:387


_loadPageSource

Protected _loadPageSource(): Promise<void | PageData>

Load page source so call load method on controller and his extensions. Merge loaded state and render it.

Returns

Promise<void | PageData>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:447


_runPostManageHandlers

Protected _runPostManageHandlers(previousManagedPage, action): Promise<unknown>

Parameters

NameType
previousManagedPageManagedPage
actionPageAction

Returns

Promise<unknown>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:813


_runPreManageHandlers

Protected _runPreManageHandlers(actualManagedPage, action): Promise<unknown>

Parameters

NameType
actualManagedPageManagedPage
actionPageAction

Returns

Promise<unknown>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:792


_setRestrictedPageStateManager

_setRestrictedPageStateManager(extension, extensionState): void

Set page state manager to extension which has restricted rights to set global state.

Parameters

NameType
extensionExtension<{}, {}, {}>
extensionStateUnknownParameters

Returns

void

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:346


_storeManagedPageSnapshot

Protected _storeManagedPageSnapshot(): void

Creates a cloned version of currently managed page and stores it in a helper property. Snapshot is used in manager handlers to easily determine differences between the current and the previous state.

Returns

void

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:285


_stripManagedPageValueForPublic

Protected _stripManagedPageValueForPublic(value): Object

Removes properties we do not want to propagate outside of the page manager

Parameters

NameTypeDescription
valueManagedPageThe managed page object to strip down

Returns

Object

NameType
controllerRouteController
optionsRouteOptions
paramsRouteParams
routeAbstractRoute<string | RoutePathExpression>
viewunknown

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:336


_switchToPageStateManager

Protected _switchToPageStateManager(): void

Iterates over extensions of current controller and switches each one to pageStateManager and clears their partial state.

Returns

void

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:434


_switchToPageStateManagerAfterLoaded

_switchToPageStateManagerAfterLoaded(extension, extensionState): void

For defined extension switches to pageStageManager and clears partial state after extension state is loaded.

Parameters

NameType
extensionExtension<{}, {}, {}>
extensionStateUnknownParameters

Returns

void

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:367


_updatePageSource

Protected _updatePageSource(): Promise<void | PageData>

Update page source so call update method on controller and his extensions. Merge updated state and render it.

Returns

Promise<void | PageData>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:584


destroy

destroy(): Promise<void>

Finalization callback, called when the page manager is being discarded. This usually happens when the page is hot-reloaded at the client side.

Returns

Promise<void>

Overrides

PageManager.destroy

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:236


getViewController

Protected getViewController(route): Promise<{ controller: RouteController ; view: RouteView }>

Parameters

NameType
routeAbstractRoute<string | RoutePathExpression>

Returns

Promise<{ controller: RouteController ; view: RouteView }>

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:837


init

init(): void

Initializes the page manager.

Returns

void

Overrides

PageManager.init

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:114


manage

manage(«destructured»): Promise<void | PageData>

Starts to manage the provided controller and its view. The manager stops the management of any previously managed controller and view.

The controller and view will be initialized and rendered either into the UI (at the client-side) or to the response to send to the client (at the server-side).

Parameters

NameType
«destructured»ManageArgs

Returns

Promise<void | PageData>

A promise that will resolve to information about the rendered page. The status will contain the HTTP status code to send to the client (at the server side) or determine the type of error page to navigate to (at the client side).

Overrides

PageManager.manage

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:133


postManage

postManage(): void

Called by router after currently managed route is resolved.

Returns

void

Overrides

PageManager.postManage

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:227


preManage

preManage(): Promise<void>

Pre manage handler, should be called and awaited before tryint to handle new route handler. This pre manage takes care of canceling any currently executed route handlers and returns promise which is resolved when previous page finished loading (even if it got canceled).

Returns

Promise<void>

Overrides

PageManager.preManage

Defined in

packages/core/src/page/manager/AbstractPageManager.ts:123