import * as i0 from '@angular/core'; import { OnChanges, AfterViewInit, OnDestroy, ElementRef, SimpleChanges } from '@angular/core'; /** * @Directive RxUnpatch * * @description * * NOTE: This directive does nothing on zoneless mode. * * The `unpatch` directive helps in partially migrating to zone-less apps as well as getting rid * of unnecessary renderings through zones `addEventListener` patches. * It can be used on any element you apply event bindings. * * The current way of binding events to the DOM is to use output bindings: * ```html * * ``` * * The problem is that every event registered over `()` syntax, e.g. `(click)` * marks the component and all its ancestors as dirty and re-renders the whole component tree. * This is because zone.js patches the native browser API and whenever one of the patched APIs is used it re-renders. * * So even if your button is not related to a change that needs a re-render the app will re-render completely. * This leads to bad performance. This is especially helpful if you work with frequently fired events like 'mousemove' * * `unpatch` directive solves that problem. * * Included Features: * - by default un-patch all registered listeners of the host it is applied on * - un-patch only a specified set of registered event listeners * - works zone independent (it directly checks the widow for patched APIs and un-patches them without the use of `runOutsideZone` which brings more performance) * - Not interfering with any logic executed by the registered callback * * @usageNotes * * The `unpatch` directive can be used like shown here: * ```html * * * ``` * * @publicApi */ declare class RxUnpatch implements OnChanges, AfterViewInit, OnDestroy { private host; private isZoneless; private destroyRef; /** * @description * List of events that the element should be unpatched from. When input is empty or undefined, * the element is unpatched from all zone-patched events. * * Full list of zone-patched browser events can be found in * [this document](https://github.com/angular/angular/blob/master/packages/zone.js/STANDARD-APIS.md#browser). * */ events?: string[]; private events$; private listeners; constructor(host: ElementRef); ngOnChanges({ events }: SimpleChanges): void; ngAfterViewInit(): void; ngOnDestroy(): void; private reapplyUnPatchedEventListeners; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } export { RxUnpatch };