@eclipse-scout/core
Version:
Eclipse Scout runtime
39 lines • 1.6 kB
TypeScript
import { ObjectType } from './index';
/**
* This class is used to extend an existing Scout object. In order to use the extension feature
* you must subclass Extension an implement an init method where you register the methods
* you want to extend. Example:
*
* scout.MyExtension.prototype.init = function() {
* this.extend(scout.MyStringField.prototype, '_init');
* this.extend(scout.MyStringField.prototype, '_renderProperties');
* };
*
* Then you implement methods with the same name and signature on the extension class. Example:
*
* scout.MyExtension.prototype._init = function(model) {
* this.next(model);
* this.extended.setProperty('bar', 'foo');
* };
*
* The extension feature sets two properties on the extension instance before the extended method
* is called. Note: the function scope (this) is set to the extension instance when the extended
* function is called:
*
* next: is a reference to the next extended function or the original function of the extended
* object, in case the current extension is the last extension in the extension chain.
*
* extended: is the extended or original object.
*/
export declare class Extension<E> {
extended: E;
next: (...args: any[]) => any;
extend(extended: E, funcName: string): void;
/**
* Calls {@link scout.create} for each extension class in the given extensions array.
*
* @param extensions a single objectType or an array of objectTypes
*/
static install(extensions: string | ObjectType | (string | ObjectType)[]): void;
}
//# sourceMappingURL=Extension.d.ts.map