Open guybowden opened 4 years ago
In this simple redirect example why are there async functions?
https://github.com/victoriabernard92/template-registry/blob/master/templates/javascript/redirect.js#L1
This could be re-written without the async keywords and appears to work the same.
function handleRequest(request) { return Response.redirect(someURLToRedirectTo, code) } addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)) }) /** * Example Input * @param {Request} url where to redirect the response * @param {number?=301|302} type permanent or temporary redirect */ const someURLToRedirectTo = 'https://www.google.com' const code = 301
In this simple redirect example why are there async functions?
https://github.com/victoriabernard92/template-registry/blob/master/templates/javascript/redirect.js#L1
This could be re-written without the async keywords and appears to work the same.