Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set isActive(isActive) {
this.foundation_.setActive(isActive);
}
get preventDefaultOnClick() {
return this.foundation_.preventsDefaultOnClick();
}
set preventDefaultOnClick(preventDefaultOnClick) {
this.foundation_.setPreventDefaultOnClick(preventDefaultOnClick);
}
protected root_!: HTMLElement; // assigned in MDCComponent constructor
private ripple_ = MDCRipple.attachTo(this.root_);
destroy() {
this.ripple_.destroy();
super.destroy();
}
getDefaultFoundation() {
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
const adapter: MDCTabAdapter = {
addClass: (className) => this.root_.classList.add(className),
removeClass: (className) => this.root_.classList.remove(className),
registerInteractionHandler: (type, handler) => this.listen(type, handler),
deregisterInteractionHandler: (type, handler) => this.unlisten(type, handler),
getOffsetWidth: () => this.root_.offsetWidth,
if (rippleFactory === void 0) { rippleFactory = function (el) { return MDCRipple.attachTo(el); }; }
this.navIcon_ = this.root_.querySelector(strings.NAVIGATION_ICON_SELECTOR);
[].forEach.call(this.root_.querySelectorAll(strings.ICON_SELECTOR), (icon: HTMLElement) => {
const ripple = MDCRipple.attachTo(icon);
ripple.unbounded = true;
this.ripples_.push(ripple);
});
}
initialize(rippleFactory: MDCRippleFactory = (el) => MDCRipple.attachTo(el)) {
this.navIcon_ = this.root_.querySelector(strings.NAVIGATION_ICON_SELECTOR);
toggleOnClick = () => {
this.on = !this.on;
if (this.ripple) {
MDCRipple.attachTo(this.iconButton, {isUnbounded: true});
}
}
}