UNPKG

@ima/core

Version:

IMA.js framework for isomorphic javascript application

116 lines 2.7 kB
import { Extension } from './Extension'; import { EventBusEventHandler } from '../event/EventBus'; import { Dependencies } from '../oc/ObjectContainer'; import { PageState, PageStateManager } from '../page/state/PageStateManager'; import { RouteParams } from '../router/AbstractRoute'; /** * Abstract extension */ export declare abstract class AbstractExtension<S extends PageState = {}, R extends RouteParams = {}, SS extends S = S> extends Extension<S, R, SS> { static $name?: string; static $dependencies: Dependencies; [key: PropertyKey]: any | EventBusEventHandler; /** * State manager. */ protected _pageStateManager?: PageStateManager<SS>; /** * Flag indicating whether the PageStateManager should be used instead * of partial state. */ protected _usingStateManager: boolean; protected _partialStateSymbol: symbol; /** * The HTTP response code to send to the client. */ status: number; /** * The route parameters extracted from the current route. */ params: R; /** * @inheritDoc */ init(): Promise<void> | void; /** * @inheritDoc */ destroy(): Promise<void> | void; /** * @inheritDoc */ activate(): Promise<void> | void; /** * @inheritDoc */ deactivate(): Promise<void> | void; /** * @inheritDoc */ load(): Promise<S> | S; /** * @inheritDoc */ update(prevParams?: R): Promise<S> | S; /** * @inheritDoc */ setState<K extends keyof S>(statePatch: Pick<S, K> | S | null): void; /** * @inheritDoc */ getState(): SS; /** * @inheritDoc */ beginStateTransaction(): void; /** * @inheritDoc */ commitStateTransaction(): void; /** * @inheritDoc */ cancelStateTransaction(): void; /** * @inheritDoc */ setPartialState(partialStatePatch: S): void; /** * @inheritDoc */ getPartialState(): Partial<SS>; /** * @inheritDoc */ clearPartialState(): void; /** * @inheritDoc */ setRouteParams(params?: R): void; /** * @inheritDoc */ getRouteParams(): R; /** * @inheritDoc */ setPageStateManager(pageStateManager?: PageStateManager<SS>): void; /** * @inheritDoc */ switchToStateManager(): void; /** * @inheritDoc */ switchToPartialState(): void; /** * @inheritDoc */ getHttpStatus(): number; /** * Returns array of allowed state keys for extension. */ getAllowedStateKeys(): (keyof S)[]; } //# sourceMappingURL=AbstractExtension.d.ts.map