MCPcopy
hub / github.com/angular/angular / createViewEffect

Function createViewEffect

packages/core/src/render3/reactivity/effect.ts:297–313  ·  view source on GitHub ↗
(
  view: LView,
  notifier: ChangeDetectionScheduler,
  fn: (onCleanup: EffectCleanupRegisterFn) => void,
)

Source from the content-addressed store, hash-verified

295 }))();
296
297export function createViewEffect(
298 view: LView,
299 notifier: ChangeDetectionScheduler,
300 fn: (onCleanup: EffectCleanupRegisterFn) => void,
301): ViewEffectNode {
302 const node = Object.create(VIEW_EFFECT_NODE) as ViewEffectNode;
303 node.view = view;
304 node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
305 node.notifier = notifier;
306 node.fn = createEffectFn(node, fn);
307
308 view[EFFECTS] ??= new Set();
309 view[EFFECTS].add(node);
310
311 node.consumerMarkedDirty(node);
312 return node;
313}
314
315export function createRootEffect(
316 fn: (onCleanup: EffectCleanupRegisterFn) => void,

Callers 1

effectFunction · 0.85

Calls 4

createEffectFnFunction · 0.85
consumerMarkedDirtyMethod · 0.80
createMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…