ng2-events
Version:
Supercharge your Angular2+ event handling
29 lines (28 loc) • 1.12 kB
TypeScript
import { Renderer2, ElementRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from "@angular/core";
import * as i0 from "@angular/core";
/**
* Conditionally apply event listeners to an element
*
* Usage:
* <button [ev-condition]="isActive()"
* ev-events="click"
* (ev-fire)="handleClick($event)">...</button>
*
* Notes:
* The [ev-events] property can be either a string or an array of strings to handle multiple events
*/
export declare class ConditionEventDirective implements OnChanges, OnDestroy {
private elm;
private renderer;
condition: boolean;
events: string | string[];
fire: EventEmitter<any>;
private listeners;
constructor(elm: ElementRef, renderer: Renderer2);
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
private unregisterAll;
private addListener;
static ɵfac: i0.ɵɵFactoryDeclaration<ConditionEventDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ConditionEventDirective, "[ev-condition]", never, { "condition": "ev-condition"; "events": "ev-events"; }, { "fire": "ev-fire"; }, never>;
}