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

Function trackLeavingNodes

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

Source from the content-addressed store, hash-verified

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

Callers 4

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