You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the JavaScript workers don't allow you to use async methods for handlers. In some cases, this is convenient as the methods may need to wait for some resources before returning the response. Async methods are supported since Javy 1.0.0, so we should be able to implement them in wws.
This is an example of an async worker:
// Using an async function to reply!asyncfunctionhandle(request){// Body responseconstbody=`Hello world!`;// Build a new responseletresponse=newResponse(body);// Add a new headerresponse.headers.set("x-generated-by","wasm-workers-server");returnresponse;}addEventListener('fetch',event=>{event.respondWith(handle(event.request));});
Even though it doesn't require an async method, we can use it as an example.
Describe the solution you'd like
I would like to use async when defining methods in JavaScript workers. Some libraries and several examples that I found require this feature.
It's available in Javy 1.0.0, so it may require to upgrade the JavaScript kit and start using the new crate from the Javy team: https://crates.io/crates/javy.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently, the JavaScript workers don't allow you to use
async
methods for handlers. In some cases, this is convenient as the methods may need to wait for some resources before returning the response.Async
methods are supported since Javy 1.0.0, so we should be able to implement them inwws
.This is an example of an
async
worker:Even though it doesn't require an
async
method, we can use it as an example.Describe the solution you'd like
I would like to use
async
when defining methods in JavaScript workers. Some libraries and several examples that I found require this feature.It's available in Javy 1.0.0, so it may require to upgrade the JavaScript kit and start using the new crate from the Javy team: https://crates.io/crates/javy.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: