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

Function producerAddLiveConsumer

packages/core/primitives/signals/src/graph.ts:528–549  ·  view source on GitHub ↗

* Add `consumer` as a live consumer of this node. * * Note that this operation is potentially transitive. If this node becomes live, then it becomes * a live consumer of all of its current producers.

(node: ReactiveNode, link: ReactiveLink)

Source from the content-addressed store, hash-verified

526 * a live consumer of all of its current producers.
527 */
528function producerAddLiveConsumer(node: ReactiveNode, link: ReactiveLink): void {
529 const consumersTail = node.consumersTail;
530 const wasLive = consumerIsLive(node);
531 if (consumersTail !== undefined) {
532 link.nextConsumer = consumersTail.nextConsumer;
533 consumersTail.nextConsumer = link;
534 } else {
535 link.nextConsumer = undefined;
536 node.consumers = link;
537 }
538 link.prevConsumer = consumersTail;
539 node.consumersTail = link;
540 if (!wasLive) {
541 for (
542 let link: ReactiveLink | undefined = node.producers;
543 link !== undefined;
544 link = link.nextProducer
545 ) {
546 producerAddLiveConsumer(link.producer, link);
547 }
548 }
549}
550
551function producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined {
552 const producer = link.producer;

Callers 1

producerAccessedFunction · 0.85

Calls 1

consumerIsLiveFunction · 0.85

Tested by

no test coverage detected