@ima/core
Version:
IMA.js framework for isomorphic javascript application
145 lines (144 loc) • 3.72 kB
JavaScript
import { Controller } from './Controller';
/**
* 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 class ControllerDecorator extends Controller {
/**
* The controller being decorated.
*/ _controller;
/**
* The meta page attributes manager.
*/ _metaManager;
/**
* The application router.
*/ _router;
/**
* Localization phrases dictionary.
*/ _dictionary;
/**
* Application settings for the current application environment.
*/ _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, metaManager, router, dictionary, settings){
super();
this._controller = controller;
this._metaManager = metaManager;
this._router = router;
this._dictionary = dictionary;
this._settings = settings;
}
/**
* @inheritDoc
*/ init() {
this._controller.init();
}
/**
* @inheritDoc
*/ destroy() {
this._controller.destroy();
}
/**
* @inheritDoc
*/ activate() {
this._controller.activate();
}
/**
* @inheritDoc
*/ deactivate() {
this._controller.deactivate();
}
/**
* @inheritDoc
*/ load() {
return this._controller.load();
}
/**
* @inheritDoc
*/ update(prevParams = {}) {
return this._controller.update(prevParams);
}
/**
* @inheritDoc
*/ setState(statePatch) {
this._controller.setState(statePatch);
}
/**
* @inheritDoc
*/ getState() {
return this._controller.getState();
}
/**
* @inheritDoc
*/ beginStateTransaction() {
this._controller.beginStateTransaction();
}
/**
* @inheritDoc
*/ commitStateTransaction() {
this._controller.commitStateTransaction();
}
/**
* @inheritDoc
*/ cancelStateTransaction() {
this._controller.cancelStateTransaction();
}
/**
* @inheritDoc
*/ addExtension(extension, extensionInstance) {
this._controller.addExtension(extension, extensionInstance);
}
/**
* @inheritDoc
*/ getExtension(extension) {
return this._controller.get(extension);
}
/**
* @inheritDoc
*/ getExtensions() {
return this._controller.getExtensions();
}
/**
* @inheritDoc
*/ setMetaParams(loadedResources) {
this._controller.setMetaParams(loadedResources, this._metaManager, this._router, this._dictionary, this._settings);
}
/**
* @inheritDoc
*/ setRouteParams(params = {}) {
this._controller.setRouteParams(params);
}
/**
* @inheritDoc
*/ getRouteParams() {
return this._controller.getRouteParams();
}
/**
* @inheritDoc
*/ setPageStateManager(pageStateManager) {
this._controller.setPageStateManager(pageStateManager);
}
/**
* @inheritDoc
*/ getHttpStatus() {
return this._controller.getHttpStatus();
}
/**
* Returns the meta attributes manager configured by the decorated
* controller.
*
* @return The Meta attributes manager configured by the
* decorated controller.
*/ getMetaManager() {
return this._metaManager;
}
}
//# sourceMappingURL=ControllerDecorator.js.map