* 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)
| 521 | * a live consumer of all of its current producers. |
| 522 | */ |
| 523 | function producerAddLiveConsumer(node: ReactiveNode, link: ReactiveLink): void { |
| 524 | const consumersTail = node.consumersTail; |
| 525 | const wasLive = consumerIsLive(node); |
| 526 | if (consumersTail !== undefined) { |
| 527 | link.nextConsumer = consumersTail.nextConsumer; |
| 528 | consumersTail.nextConsumer = link; |
| 529 | } else { |
| 530 | link.nextConsumer = undefined; |
| 531 | node.consumers = link; |
| 532 | } |
| 533 | link.prevConsumer = consumersTail; |
| 534 | node.consumersTail = link; |
| 535 | if (!wasLive) { |
| 536 | for ( |
| 537 | let link: ReactiveLink | undefined = node.producers; |
| 538 | link !== undefined; |
| 539 | link = link.nextProducer |
| 540 | ) { |
| 541 | producerAddLiveConsumer(link.producer, link); |
| 542 | } |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | function producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined { |
| 547 | const producer = link.producer; |
no test coverage detected
searching dependent graphs…