Skip to main content

Class: ServerPageManager

@ima/core.ServerPageManager

Page manager for controller on the server side.

Hierarchy

Constructors

constructor

new ServerPageManager(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-

Inherited from

AbstractPageManager.constructor

Defined in

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

Properties

_dispatcher

Protected _dispatcher: Dispatcher

Inherited from

AbstractPageManager._dispatcher

Defined in

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


_managedPage

Protected _managedPage: ManagedPage

Details of the currently managed page.

Inherited from

AbstractPageManager._managedPage

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.

Inherited from

AbstractPageManager._pageFactory

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.

Inherited from

AbstractPageManager._pageHandlerRegistry

Defined in

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


_pageRenderer

Protected _pageRenderer: PageRenderer

The current renderer of the page.

Inherited from

AbstractPageManager._pageRenderer

Defined in

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


_pageStateManager

Protected _pageStateManager: PageStateManager<{}>

The current page state manager.

Inherited from

AbstractPageManager._pageStateManager

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

Inherited from

AbstractPageManager._previousManagedPage

Defined in

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

Accessors

$dependencies

Static get $dependencies(): Dependencies

Returns

Dependencies

Defined in

packages/core/src/page/manager/ServerPageManager.ts:15

Methods

#cancelable

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

Type parameters

Name
T

Parameters

NameType
promiseT

Returns

Promise<T>

Inherited from

AbstractPageManager.#cancelable

Defined in

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


_activateController

Protected _activateController(): Promise<void>

Activate managed instance of controller.

Returns

Promise<void>

Inherited from

AbstractPageManager._activateController

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>

Inherited from

AbstractPageManager._activateExtensions

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>

Inherited from

AbstractPageManager._activatePageSource

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

Inherited from

AbstractPageManager._clearComponentState

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

Inherited from

AbstractPageManager._constructManagedPageValue

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>

Inherited from

AbstractPageManager._deactivateController

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>

Inherited from

AbstractPageManager._deactivateExtensions

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>

Inherited from

AbstractPageManager._deactivatePageSource

Defined in

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


_destroyController

Protected _destroyController(): Promise<void>

Destroy last managed instance of controller.

Returns

Promise<void>

Inherited from

AbstractPageManager._destroyController

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>

Inherited from

AbstractPageManager._destroyExtensions

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>

Inherited from

AbstractPageManager._destroyPageSource

Defined in

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


_getInitialManagedPage

Protected _getInitialManagedPage(): ManagedPage

Clear value from managed page.

Returns

ManagedPage

Inherited from

AbstractPageManager._getInitialManagedPage

Defined in

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


_getLoadedControllerState

Protected _getLoadedControllerState(): Promise<{}>

Load controller state from managed instance of controller.

Returns

Promise<{}>

Inherited from

AbstractPageManager._getLoadedControllerState

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>

Inherited from

AbstractPageManager._getLoadedExtensionsState

Defined in

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


_getUpdatedControllerState

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

Return updated controller state for current page controller.

Returns

{} | Promise<{}>

Inherited from

AbstractPageManager._getUpdatedControllerState

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>

Inherited from

AbstractPageManager._getUpdatedExtensionsState

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

Inherited from

AbstractPageManager._hasOnlyUpdate

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>

Inherited from

AbstractPageManager._initController

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>

Inherited from

AbstractPageManager._initExtensions

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>

Inherited from

AbstractPageManager._initPageSource

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>

Inherited from

AbstractPageManager._loadPageSource

Defined in

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


_runPostManageHandlers

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

Parameters

NameType
previousManagedPageManagedPage
actionPageAction

Returns

Promise<unknown>

Inherited from

AbstractPageManager._runPostManageHandlers

Defined in

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


_runPreManageHandlers

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

Parameters

NameType
actualManagedPageManagedPage
actionPageAction

Returns

Promise<unknown>

Inherited from

AbstractPageManager._runPreManageHandlers

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

Inherited from

AbstractPageManager._setRestrictedPageStateManager

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

Inherited from

AbstractPageManager._storeManagedPageSnapshot

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

Inherited from

AbstractPageManager._stripManagedPageValueForPublic

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

Inherited from

AbstractPageManager._switchToPageStateManager

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

Inherited from

AbstractPageManager._switchToPageStateManagerAfterLoaded

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>

Inherited from

AbstractPageManager._updatePageSource

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>

Inherited from

AbstractPageManager.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 }>

Inherited from

AbstractPageManager.getViewController

Defined in

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


init

init(): void

Initializes the page manager.

Returns

void

Inherited from

AbstractPageManager.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).

Inherited from

AbstractPageManager.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

Inherited from

AbstractPageManager.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>

Inherited from

AbstractPageManager.preManage

Defined in

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