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

Function createRootEffect

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

Source from the content-addressed store, hash-verified

320}
321
322export function createRootEffect(
323 fn: (onCleanup: EffectCleanupRegisterFn) => void,
324 scheduler: EffectScheduler,
325 notifier: ChangeDetectionScheduler,
326): RootEffectNode {
327 const node = Object.create(ROOT_EFFECT_NODE) as RootEffectNode;
328 node.userFn = fn;
329 node.fn = createEffectFn(node, fn);
330 node.scheduler = scheduler;
331 node.notifier = notifier;
332 node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
333 node.scheduler.add(node);
334 node.notifier.notify(NotificationSource.RootEffect);
335 return node;
336}
337
338function createEffectFn(node: EffectNode, fn: (onCleanup: EffectCleanupRegisterFn) => void) {
339 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