UNPKG

@ima/core

Version:

IMA.js framework for isomorphic javascript application

78 lines 2.53 kB
import { AbstractConstructor, Constructor } from 'type-fest'; import { Controller } from './Controller'; import { OCAliasMap } from '../config/bind'; import { Extension } from '../extension/Extension'; import { Dependencies } from '../oc/ObjectContainer'; import { PageState, PageStateManager } from '../page/state/PageStateManager'; import { RouteParams } from '../router/AbstractRoute'; /** * Basic implementation of the {@link Controller} interface, providing the * default implementation of the most of the API. */ export declare class AbstractController<S extends PageState = {}, R extends RouteParams = {}, SS extends S = S> extends Controller<S, R, SS> { protected _pageStateManager?: PageStateManager<SS>; protected _extensions: Map<keyof OCAliasMap | Constructor<Extension<any, any>> | AbstractConstructor<Extension<any, any>>, InstanceType<typeof Extension>>; /** * The HTTP response code to send to the client. */ status: number; /** * The route parameters extracted from the current route. This field is * set externally by IMA right before the {@link Controller#init} or the * {@link Controller#update} method is called. */ params: R; static $name?: string; static $dependencies: Dependencies; static $extensions?: Dependencies<Extension<any, any>>; constructor(); /** * @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 */ addExtension(extension: keyof OCAliasMap | Constructor<Extension<any, any>> | AbstractConstructor<Extension<any, any>> | InstanceType<typeof Extension>, extensionInstance?: InstanceType<typeof Extension>): void; /** * @inheritDoc */ getExtension(extension: typeof Extension): InstanceType<typeof Extension> | undefined; /** * @inheritDoc */ getExtensions(): Extension[]; /** * @inheritDoc */ setRouteParams(params?: R): void; /** * @inheritDoc */ getRouteParams(): R; /** * @inheritDoc */ setPageStateManager(pageStateManager?: PageStateManager<SS>): void; /** * @inheritDoc */ getHttpStatus(): number; } //# sourceMappingURL=AbstractController.d.ts.map