* 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)
| 526 | * a live consumer of all of its current producers. |
| 527 | */ |
| 528 | function 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 | |
| 551 | function producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined { |
| 552 | const producer = link.producer; |
no test coverage detected