Service Worker Offline Queue — click any node for details
flowchart TD Start(["Component calls
xapiClient.send(stmt)"]):::start Online{"navigator.onLine?"}:::decision Post["Attempt POST to LRS"]:::action Success{"HTTP 200?"}:::decision Done(["Done"]):::done Queue["Write statement to
IndexedDB queue"]:::queue OnlineEvt(["online event fires"]):::event Read["Worker reads queue"]:::action Flush["POST batch to LRS"]:::action Remove["Remove from queue"]:::action Loop{"Queue empty
and online?"}:::decision Start --> Online Online -- Yes --> Post Online -- No --> Queue Post --> Success Success -- Yes --> Done Success -- No --> Queue Queue --> OnlineEvt OnlineEvt --> Read Read --> Flush Flush --> Remove Remove --> Loop Loop -- No --> Read Loop -- Yes --> Done click Start call showStep("Start") click Online call showStep("Online") click Post call showStep("Post") click Success call showStep("Success") click Queue call showStep("Queue") click OnlineEvt call showStep("OnlineEvt") click Read call showStep("Read") click Flush call showStep("Flush") click Remove call showStep("Remove") click Loop call showStep("Loop") click Done call showStep("Done") classDef start fill:#1e293b,stroke:#0f172a,color:#fff,font-weight:bold classDef action fill:#4338ca,stroke:#312e81,color:#fff classDef decision fill:#ca8a04,stroke:#854d0e,color:#fff classDef queue fill:#dc2626,stroke:#7f1d1d,color:#fff classDef event fill:#0d9488,stroke:#134e4a,color:#fff classDef done fill:#16a34a,stroke:#14532d,color:#fff linkStyle default stroke:#64748b,stroke-width:2px

Step Details

Click any node in the flowchart to see the code snippet and edge cases for that step.