Skip to content
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

feat(examples): add browser fetch() example #540

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vados-cosmonic
Copy link
Contributor

@vados-cosmonic vados-cosmonic commented Dec 25, 2024

This example adds a component that uses browser-provided fetch() (and related shims) which returns the response for a GET request to a given URL.

This example should showcase how to use a transpiled component with fetch from the browser context.

Currently, the example builds and tranpsiles the component but does not test it, as we need code in the async support PR to land first.

Thanks @cytommi for finding, reporting and diagnosing this bug!

⚠️ This PR is blocked on code in the Async support PR

While fetch is being translated at the engine level, the lacking implementation of wasi:http/types is causing Request.send to not actually get called properly.

This example adds a component that uses browser-provided
`fetch()` (and related shims) which returns the response for a GET
request to a given URL.

This example should showcase how to use a transpiled component with
fetch from the browser context.

Currently, the example builds and tranpsiles the component but *does
not* test it, as we need code in the async support PR to land first.

Signed-off-by: Victor Adossi <[email protected]>
@guybedford
Copy link
Collaborator

Great to see, although yes we shouldn't include examples that depend on unreleased features I think unfortunately.

For browser examples, we are likely stuck with sync WebIDL examples mostly for now, but would still be great to see something here further.

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.

2 participants