(ctrl: GravityController)
| 70 | |
| 71 | // Pure helper: get the next cached choice ad set |
| 72 | function nextFromChoiceCache(ctrl: GravityController): AdResponse[] | null { |
| 73 | if (ctrl.choiceCache.length === 0) return null |
| 74 | const set = ctrl.choiceCache[ctrl.choiceCacheIndex % ctrl.choiceCache.length]! |
| 75 | ctrl.choiceCacheIndex = (ctrl.choiceCacheIndex + 1) % ctrl.choiceCache.length |
| 76 | return set |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Hook for fetching and rotating Gravity ads. |