-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
Description
In modern javascript, there is async and await new keywords that allows to write asynchronous code that looks like synchronous code. For instance,
async function fetchPosts() {
let response = await fetch('/api/posts');
if (response.status === 200) {
let posts = await response.json();
return posts;
}
}Is it possible to have support for that? I don't how to port my framework to racketscript without this (see. #61).
The above should be possible to be written in racketscript using a syntax that looks like the following:
(define-async (fetch-posts
(let ((response (await (fetch "/api/posts"))))
(if (= (response-status response) 200)
(await (response-json response)))))It should also be possible to define async lambda.
Reactions are currently unavailable