UNPKG

@ima/core

Version:

IMA.js framework for isomorphic javascript application

126 lines 5.27 kB
import { AbstractPageManager } from './AbstractPageManager'; import { ManageArgs } from './PageManager'; import { Dependencies } from '../..'; import { Dispatcher } from '../../event/Dispatcher'; import { EventBus } from '../../event/EventBus'; import { UnknownParameters } from '../../types'; import { Window as ImaWindow } from '../../window/Window'; import { PageHandlerRegistry } from '../handler/PageHandlerRegistry'; import { PageFactory } from '../PageFactory'; import { PageRenderer } from '../renderer/PageRenderer'; import { PageStateManager } from '../state/PageStateManager'; /** * Page manager for controller on the client side. */ export declare class ClientPageManager extends AbstractPageManager { /** * The utility for manipulating the global context and global * client-side-specific APIs. */ private _window; /** * The event bus for dispatching and listening for custom IMA events * propagated through the DOM. */ private _eventBus; /** * Event listener for the custom DOM events used by the event bus, * bound to this instance. */ private _boundOnCustomEventHandler; static get $dependencies(): Dependencies; /** * Initializes the client-side page manager. * * @param 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. * @param pageRenderer The current renderer of the page. * @param stateManager The current page state manager. * @param handlerRegistry Instance of HandlerRegistry that * holds a list of pre-manage and post-manage handlers. * @param window The utility for manipulating the global context * and global client-side-specific APIs. * @param dispatcher IMA Dispatcher. * @param eventBus The event bus for dispatching and listening * for custom IMA events propagated through the DOM. */ constructor(pageFactory: PageFactory, pageRenderer: PageRenderer, pageStateManager: PageStateManager, handlerRegistry: PageHandlerRegistry, dispatcher: Dispatcher, window: ImaWindow, eventBus: EventBus); /** * @inheritDoc */ init(): void; /** * @inheritDoc */ manage({ route, options, params, action }: ManageArgs): Promise<void | import("../PageTypes").PageData>; /** * @inheritDoc */ destroy(): Promise<void>; /** * Custom DOM event handler. * * The handler invokes the event listener in the active controller, if such * listener is present. The name of the controller's listener method is * created by turning the first symbol of the event's name to upper case, * and then prefixing the result with the 'on' prefix. * * For example: for an event named 'toggle' the controller's listener * would be named 'onToggle'. * * The controller's listener will be invoked with the event's data as an * argument. * * @param event The encountered event bus DOM event. */ _onCustomEventHandler(event: CustomEvent): void; /** * Extracts the details of the provided event bus custom DOM event, along * with the expected name of the current controller's method for * intercepting the event. * * @param event The encountered event bus custom DOM event. * @return The event's * details. */ _parseCustomEvent(event: CustomEvent): { prefix: string; method: string; data: any; eventName: string; }; /** * Attempts to handle the currently processed event bus custom DOM event * using the current controller. The method returns `true` if the * event is handled by the controller. * * @param method The name of the method the current controller * should use to process the currently processed event bus custom * DOM event. * @param data The custom event's data. * @return `true` if the event has been handled by the * controller, `false` if the controller does not have a * method for processing the event. */ _handleEventWithController(prefix: string, method: string, data: UnknownParameters): boolean; /** * Attempts to handle the currently processed event bus custom DOM event * using the registered extensions of the current controller. The method * returns `true` if the event is handled by the controller. * * @param method The name of the method the current controller * should use to process the currently processed event bus custom * DOM event. * @param data The custom event's data. * @return `true` if the event has been handled by one of * the controller's extensions, `false` if none of the * controller's extensions has a method for processing the event. */ _handleEventWithExtensions(prefix: string, method: string, data: UnknownParameters): boolean; /** * On change event handler set state to view. */ _onChangeStateHandler(state: UnknownParameters): void; } //# sourceMappingURL=ClientPageManager.d.ts.map