Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: fix bug with polyfill fetch #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Xuan-Yu-San wants to merge 1 commit into Azure:main
base: main
Choose a base branch
Loading
from Xuan-Yu-San:main

Conversation

Copy link

@Xuan-Yu-San Xuan-Yu-San commented Oct 8, 2023

No description provided.

piotr-cz, xiaobannc, and harryYao reacted with eyes emoji
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Author

When using fetch-event-source in the webview of iOS or Android, it is important to note that the fetch method is not implemented as native code. Instead, it is a polyfill that provides functionality similar to the native fetch method. One specific difference is that the polyfill does not have a response with a body of type ReadableStream. Considering this limitation is therefore crucial in such cases.

Copy link

your code may cause repeated fetch requests. I adjusted it.

export async function getBytes(response: Response, onChunk: (arr: Uint8Array) => void) {
 const reader = response.body?.getReader();
 if (reader) {
 let result;
 while (!(result = await reader.read()).done) {
 onChunk(result.value);
 }
 } else {
 onChunk(new Uint8Array(await response.arrayBuffer()));
 }
}
Jlnvv-tom reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /