Skip to content

Add asyncIterator - #133

Closed
Modeeeeeee wants to merge 2 commits into
sitespeedio:mainfrom
Modeeeeeee:UZ-LIETUVA-VYRAI
Closed

Modeeeeeee wants to merge 2 commits into
sitespeedio:mainfrom
Modeeeeeee:UZ-LIETUVA-VYRAI

Conversation

@Modeeeeeee

Copy link
Copy Markdown

Added support for asyncIterator. Per docs (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) it supports both sync and async iterators so this PR includes

  • for await addition (harFromMessages is now async)
  • added a function processMessage
  • added a dummy test which has an asyncIterator

@soulgalore

Copy link
Copy Markdown
Member

Looks ok, so I'm thinking maybe having two different functions, but I can fix that. I'm doing a big refactoring that I want to happen first, but I can cherry pick your change if it's ok for you. Probably can merge/release Sunday.

@Modeeeeeee

Copy link
Copy Markdown
Author

@soulgalore Sounds great !

@Modeeeeeee

Copy link
Copy Markdown
Author

@soulgalore How is the release going ?

@paulius-valiunas

Copy link
Copy Markdown

are you still planning to merge this eventually?

@soulgalore

Copy link
Copy Markdown
Member

Yes, let me try to fix the async iterator, haven't had any focus on it yet.

soulgalore added a commit that referenced this pull request Nov 3, 2026
People who collect DevTools events as a stream, for example from a live CDP session, had to collect every message into an array before they could create a HAR. For long sessions that means keeping a lot of raw messages in memory only to pass them on.

harFromMessagesAsync takes an async iterable and handles each message when it arrives. harFromMessages stays synchronous with the same API, so existing users are not affected and no major release is needed. Both functions share the same code, so they give the same HAR.

Based on the idea and first implementation by Modeeeeeee in #133.

Assisted-by: Claude Opus 5.5 [email protected]
@soulgalore

Copy link
Copy Markdown
Member

Fixed in #165

@soulgalore soulgalore closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants