@ima/core
Version:
IMA.js framework for isomorphic javascript application
133 lines • 3.86 kB
TypeScript
import { AbstractConstructor, Constructor } from 'type-fest';
import { Controller, LoadedResources } from './Controller';
import { Settings } from '../boot';
import { OCAliasMap } from '../config/bind';
import { Dictionary } from '../dictionary/Dictionary';
import { Extension } from '../extension/Extension';
import { MetaManager } from '../meta/MetaManager';
import { PageState, PageStateManager } from '../page/state/PageStateManager';
import { RouteParams } from '../router/AbstractRoute';
import { Router } from '../router/Router';
/**
* Decorator for page controllers. The decorator manages references to the meta
* attributes manager and other utilities so these can be easily provided to
* the decorated page controller when needed.
*/
export declare class ControllerDecorator<S extends PageState = {}, R extends RouteParams = {}, SS extends S = S> extends Controller<S, R, SS> {
/**
* The controller being decorated.
*/
protected _controller: Controller<S, R, SS>;
/**
* The meta page attributes manager.
*/
protected _metaManager: MetaManager;
/**
* The application router.
*/
protected _router: Router;
/**
* Localization phrases dictionary.
*/
protected _dictionary: Dictionary;
/**
* Application settings for the current application environment.
*/
protected _settings: Settings;
/**
* Initializes the controller decorator.
*
* @param controller The controller being decorated.
* @param metaManager The meta page attributes manager.
* @param router The application router.
* @param dictionary Localization phrases dictionary.
* @param settings Application settings for the
* current application environment.
*/
constructor(controller: Controller<S, R, SS>, metaManager: MetaManager, router: Router, dictionary: Dictionary, settings: Settings);
/**
* @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
*/
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
*/
setMetaParams(loadedResources: LoadedResources<SS>): void;
/**
* @inheritDoc
*/
setRouteParams(params?: R): void;
/**
* @inheritDoc
*/
getRouteParams(): R;
/**
* @inheritDoc
*/
setPageStateManager(pageStateManager?: PageStateManager<SS>): void;
/**
* @inheritDoc
*/
getHttpStatus(): number;
/**
* Returns the meta attributes manager configured by the decorated
* controller.
*
* @return The Meta attributes manager configured by the
* decorated controller.
*/
getMetaManager(): MetaManager;
}
//# sourceMappingURL=ControllerDecorator.d.ts.map