@angular-mdc/web
Version:
79 lines (77 loc) • 2.93 kB
JavaScript
/**
* @license
* Copyright (c) Dominic Carretto
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE
*/
/**
* @fileoverview added by tsickle
* Generated from: base/component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @template FoundationType
*/
var /**
* @template FoundationType
*/
MDCComponent = /** @class */ (function () {
function MDCComponent(elementRef, foundation) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
this._elementRef = elementRef;
this.initialize.apply(this, args);
// Note that we initialize foundation here and not within the constructor's default param.
this._foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
}
/* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
/* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
/**
* @param {...?} _args
* @return {?}
*/
MDCComponent.prototype.initialize = /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
/**
* @param {...?} _args
* @return {?}
*/
function () {
var _args = [];
for (var _i = 0; _i < arguments.length; _i++) {
_args[_i] = arguments[_i];
}
// Subclasses can override this to do any additional setup work that would be considered part of a
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is
// initialized. Any additional arguments besides root and foundation will be passed in here.
};
/**
* @return {?}
*/
MDCComponent.prototype.getDefaultFoundation = /**
* @return {?}
*/
function () {
// Subclasses must override this method to return a properly configured foundation class for the
// component.
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
'foundation class');
};
/**
* @return {?}
*/
MDCComponent.prototype.destroy = /**
* @return {?}
*/
function () {
var _a;
// Subclasses may implement this method to release any resources / deregister any listeners they have
// attached. An example of this might be deregistering a resize event from the window object.
(_a = this._foundation) === null || _a === void 0 ? void 0 : _a.destroy();
};
return MDCComponent;
}());
export { MDCComponent };
//# sourceMappingURL=base.es5.js.map