Skip to content

Commit

Permalink
refactor(core): remove usage of the useCapture arg to the listener in…
Browse files Browse the repository at this point in the history
…struction (angular#48046)

The useCapture argument of the listener instruction was only
meaningful in the Renderer3 case. Since the Renderer3 code was
removed this argument has no use. Note that we can perform
additional cleanup and remove the useCapture argument from the
listener instruction (this would require change to the instruction
signature, though).

PR Close angular#48046
  • Loading branch information
pkozlowski-opensource authored and trekladyone committed Feb 1, 2023
1 parent 99ec7d8 commit c00fca8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/core/src/render3/instructions/listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import {assertIndexInRange} from '../../util/assert';
import {isObservable} from '../../util/lang';
import {PropertyAliasValue, TNode, TNodeFlags, TNodeType} from '../interfaces/node';
import {PropertyAliasValue, TNode, TNodeType} from '../interfaces/node';
import {GlobalTargetResolver, Renderer} from '../interfaces/renderer';
import {RElement} from '../interfaces/renderer_dom';
import {isDirectiveHost} from '../interfaces/type_checks';
Expand All @@ -31,7 +31,8 @@ import {getOrCreateLViewCleanup, getOrCreateTViewCleanup, handleError, loadCompo
*
* @param eventName Name of the event
* @param listenerFn The function to be called when event emits
* @param useCapture Whether or not to use capture in event listener
* @param useCapture Whether or not to use capture in event listener - this argument is a reminder
* from the Renderer3 infrastructure and should be removed from the instruction arguments
* @param eventTargetResolver Function that returns global target information in case this listener
* should be attached to a global object like window, document or body
*
Expand All @@ -44,8 +45,7 @@ export function ɵɵlistener(
const tView = getTView();
const tNode = getCurrentTNode()!;
listenerInternal(
tView, lView, lView[RENDERER], tNode, eventName, listenerFn, !!useCapture,
eventTargetResolver);
tView, lView, lView[RENDERER], tNode, eventName, listenerFn, eventTargetResolver);
return ɵɵlistener;
}

Expand Down Expand Up @@ -77,7 +77,7 @@ export function ɵɵsyntheticHostListener(
const tView = getTView();
const currentDef = getCurrentDirectiveDef(tView.data);
const renderer = loadComponentRenderer(currentDef, tNode, lView);
listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, false);
listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn);
return ɵɵsyntheticHostListener;
}

Expand Down Expand Up @@ -115,8 +115,7 @@ function findExistingListener(

function listenerInternal(
tView: TView, lView: LView<{}|null>, renderer: Renderer, tNode: TNode, eventName: string,
listenerFn: (e?: any) => any, useCapture: boolean,
eventTargetResolver?: GlobalTargetResolver): void {
listenerFn: (e?: any) => any, eventTargetResolver?: GlobalTargetResolver): void {
const isTNodeDirectiveHost = isDirectiveHost(tNode);
const firstCreatePass = tView.firstCreatePass;
const tCleanup: false|any[] = firstCreatePass && getOrCreateTViewCleanup(tView);
Expand Down

0 comments on commit c00fca8

Please sign in to comment.