()
| 33 | let timer: ReturnType<typeof setTimeout> | null = null; |
| 34 | |
| 35 | const flush = () => { |
| 36 | if (!pending.length) return; |
| 37 | const events = pending.splice(0); |
| 38 | try { |
| 39 | const encoded = encodeURIComponent(btoa(JSON.stringify(events))); |
| 40 | const url = `${BEACON_URL}?app=${BEACON_APP}&data=${encoded}`; |
| 41 | fetch(url).catch(() => {}); |
| 42 | } catch {} |
| 43 | }; |
| 44 | |
| 45 | const schedule = () => { |
| 46 | if (timer) return; |