MCPcopy Create free account
hub / github.com/angular/angular / trackLeavingNodes

Function trackLeavingNodes

packages/core/src/animation/utils.ts:236–251  ·  view source on GitHub ↗
(tNode: TNode, el: HTMLElement, lView?: LView)

Source from the content-addressed store, hash-verified

234 * duplicates from showing up on screen mid-animation.
235 */
236export function trackLeavingNodes(tNode: TNode, el: HTMLElement, lView?: LView): void {
237 // We need to track this tNode's element just to be sure we don't add
238 // a new RNode for this TNode while this one is still animating away.
239 // once the animation is complete, we remove this reference.
240 // The declaration view is recorded so `cancelLeavingNodes` can tell apart two
241 // separate instances of the same template from the same view re-rendered.
242 const declarationView = getDeclarationView(lView);
243 const nodes = leavingNodes.get(tNode);
244 if (nodes) {
245 if (!nodes.some((node) => node.el === el)) {
246 nodes.push({el, declarationView});
247 }
248 } else {
249 leavingNodes.set(tNode, [{el, declarationView}]);
250 }
251}
252
253/**
254 * Retrieves the list of specified enter animations from the lView

Callers 3

animateLeaveClassRunnerFunction · 0.90

Calls 5

getDeclarationViewFunction · 0.85
someMethod · 0.80
getMethod · 0.65
setMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected