@angular-mdc/web
Version:
89 lines (84 loc) • 3.7 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
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define('@angular-mdc/web/base', ['exports'], factory) :
(global = global || self, factory((global.ng = global.ng || {}, global.ng.web = global.ng.web || {}, global.ng.web.base = {})));
}(this, (function (exports) { 'use strict';
/**
* @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;
}());
exports.MDCComponent = MDCComponent;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=web-base.umd.js.map