(affectedTooltipIds: Set<string> | null)
| 77 | let pendingFullRefresh = false |
| 78 | |
| 79 | function scheduleRefresh(affectedTooltipIds: Set<string> | null) { |
| 80 | if (affectedTooltipIds) { |
| 81 | if (!pendingTooltipIds) { |
| 82 | pendingTooltipIds = new Set() |
| 83 | } |
| 84 | affectedTooltipIds.forEach((id) => pendingTooltipIds!.add(id)) |
| 85 | } else { |
| 86 | pendingFullRefresh = true |
| 87 | } |
| 88 | |
| 89 | if (refreshScheduled) { |
| 90 | return |
| 91 | } |
| 92 | refreshScheduled = true |
| 93 | |
| 94 | const flush = () => { |
| 95 | refreshScheduled = false |
| 96 | const fullRefresh = pendingFullRefresh |
| 97 | const ids = pendingTooltipIds |
| 98 | pendingFullRefresh = false |
| 99 | pendingTooltipIds = null |
| 100 | |
| 101 | if (fullRefresh) { |
| 102 | refreshAllEntries() |
| 103 | } else if (ids && ids.size > 0) { |
| 104 | refreshEntriesForTooltipIds(ids) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | if (typeof requestAnimationFrame === 'function') { |
| 109 | requestAnimationFrame(flush) |
| 110 | } else { |
| 111 | Promise.resolve().then(flush) |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Only refresh entries whose tooltipId is in the affected set, |
no outgoing calls
no test coverage detected