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

Function createDebugWatchNode

packages/core/src/render3/util/signal_debug.ts:342–360  ·  view source on GitHub ↗
(targetNode: ReactiveNode)

Source from the content-addressed store, hash-verified

340}
341
342function createDebugWatchNode(targetNode: ReactiveNode): DebugWatchNode {
343 const node: DebugWatchNode = {
344 ...REACTIVE_NODE,
345 consumerIsAlwaysLive: true,
346 consumerAllowSignalWrites: true,
347 dirty: true,
348 kind: 'effect',
349 targetNode: new WeakRef(targetNode),
350 destroyed: false,
351 consumerMarkedDirty: () => {
352 if (node.destroyed) return;
353 // Schedule watch re-execution asynchronously in the next microtask after
354 // the signal update cycle completes, ceding the main thread back to the
355 // framework and avoiding synchronous re-entrancy during value computation.
356 queueMicrotask(() => runDebugWatch(node));
357 },
358 };
359 return node;
360}
361
362function runDebugWatch(node: DebugWatchNode): void {
363 if (node.destroyed) return;

Callers 1

toggleWatchSignalFunction · 0.85

Calls 1

runDebugWatchFunction · 0.85

Tested by

no test coverage detected