(key: string)
| 43 | } |
| 44 | |
| 45 | async function flushContentUpdate(key: string) { |
| 46 | const update = updateContentQueue.value.get(key) |
| 47 | if (!update) { |
| 48 | return |
| 49 | } |
| 50 | |
| 51 | updateContentQueue.value.delete(key) |
| 52 | inFlightContentKeys.value.add(key) |
| 53 | |
| 54 | try { |
| 55 | await updateSnippetContent(update.snippetId, update.contentId, update.data) |
| 56 | } |
| 57 | catch (error) { |
| 58 | console.error(error) |
| 59 | } |
| 60 | finally { |
| 61 | inFlightContentKeys.value.delete(key) |
| 62 | |
| 63 | if (updateContentQueue.value.has(key)) { |
| 64 | scheduleContentUpdate(key) |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | function scheduleContentUpdate(key: string) { |
| 70 | const pendingTimer = contentUpdateTimers.value.get(key) |
no test coverage detected