Skip to content

CollectionWorks

kavi castelo edited this page Nov 21, 2025 · 1 revision

How Collection Works

Here’s the lifecycle when Collect ALL is clicked:

1. Popup injects auto-scroll script into Medium

collectPaginatedInjected() scrolls until no new posts appear.

2. All discovered articles returned to popup

Each item includes:

  • title
  • href
  • derived post ID

3. Popup sends IDs to background service worker

Message: { action: "collect", posts: items }

4. Background builds GraphQL requests

GraphQL operation used:

postStatsTotalBundle + postResult

5. Requests batched (10 per request)

6. Results normalized and merged

7. Totals computed

8. Stored in:

chrome.storage.local.lastMediumStats

9. Popup renders:

  • totals
  • chart
  • table

Clone this wiki locally