MCPcopy
hub / github.com/angular/angular / createRootEffect

Function createRootEffect

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

Source from the content-addressed store, hash-verified

313}
314
315export function createRootEffect(
316 fn: (onCleanup: EffectCleanupRegisterFn) => void,
317 scheduler: EffectScheduler,
318 notifier: ChangeDetectionScheduler,
319): RootEffectNode {
320 const node = Object.create(ROOT_EFFECT_NODE) as RootEffectNode;
321 node.fn = createEffectFn(node, fn);
322 node.scheduler = scheduler;
323 node.notifier = notifier;
324 node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
325 node.scheduler.add(node);
326 node.notifier.notify(NotificationSource.RootEffect);
327 return node;
328}
329
330function createEffectFn(node: EffectNode, fn: (onCleanup: EffectCleanupRegisterFn) => void) {
331 return () => {

Callers 1

effectFunction · 0.85

Calls 4

createEffectFnFunction · 0.85
createMethod · 0.65
addMethod · 0.65
notifyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…