* @param {IContextPropUsed } used * @param {T} value * @private * @template T
(used, value)
| 523 | * @template T |
| 524 | */ |
| 525 | maybeUpdated_(used, value) { |
| 526 | const {prop, value: oldValue} = used; |
| 527 | const {key} = prop; |
| 528 | const usedByKey = this.usedByKey_; |
| 529 | if ( |
| 530 | oldValue === value || |
| 531 | used !== usedByKey?.get(key) || |
| 532 | !this.isConnected_() |
| 533 | ) { |
| 534 | // Either the value didn't change, or no one needs this value anymore. |
| 535 | return; |
| 536 | } |
| 537 | |
| 538 | used.value = value; |
| 539 | |
| 540 | // Notify subscribers. |
| 541 | const {subscribers} = used; |
| 542 | for (const handler of subscribers) { |
| 543 | handler(value); |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | /** |
| 548 | * The used value calculation algorithm. |
no test coverage detected