Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
getWidth:() => this._elm.nativeElement.offsetWidth,
registerInteractionHandler: (type: string, handler: EventListener) => {
this.registry.listen(this._rndr, type, handler, this._elm);
},
deregisterInteractionHandler: (type: string, handler: EventListener) => {
this.registry.unlisten(type, handler);
}
};
_foundation: {
init: Function,
destroy: Function,
float: (should: boolean) => void,
shake: (should: boolean) => void,
getWidth: () => number
} = new MDCFloatingLabelFoundation(this._mdcAdapter);
constructor(private _rndr: Renderer2, public _elm: ElementRef, private registry: MdcEventRegistry) {
super();
}
ngAfterContentInit() {
this._foundation.init();
this._initialized = true;
}
ngOnDestroy() {
this._foundation.init();
this._initialized = false;
}
}
getDefaultFoundation() {
return new MDCFloatingLabelFoundation({
addClass: (className: string) => this.root.addClass(className),
removeClass: (className: string) => this.root.removeClass(className),
getWidth: () => (this.root.ref ? this.root.ref.scrollWidth : 0),
registerInteractionHandler: (
evtType: K,
handler: SpecificEventListener
): void => this.root.addEventListener(evtType, handler),
deregisterInteractionHandler: (
evtType: K,
handler: SpecificEventListener
): void => this.root.removeEventListener(evtType, handler)
});
}
getDefaultFoundation() {
const adapter: MDCFloatingLabelAdapter = {
addClass: (className: string) => this._getHostElement().classList.add(className),
removeClass: (className: string) => this._getHostElement().classList.remove(className),
getWidth: () => this._getHostElement().scrollWidth,
registerInteractionHandler: () => { },
deregisterInteractionHandler: () => { }
};
return new MDCFloatingLabelFoundation(adapter);
}