(url: string)
| 3 | const textPromises = new Map<string, Promise<string>>(); |
| 4 | |
| 5 | const fetchTextOnce = async (url: string) => { |
| 6 | if (!fetchPromises.get(url)) { |
| 7 | fetchPromises.set(url, fetch(url)); |
| 8 | } |
| 9 | const response = await fetchPromises.get(url); |
| 10 | |
| 11 | if (response && !textPromises.get(url)) { |
| 12 | textPromises.set(url, response.text()); |
| 13 | } |
| 14 | |
| 15 | return textPromises.get(url); |
| 16 | }; |
| 17 | |
| 18 | const fetchJsonOnce = async (url: string) => { |
| 19 | if (!fetchPromises.get(url)) { |