mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2025-03-10 17:29:10 +00:00
⚗️
This commit is contained in:
parent
50ea469fdf
commit
9ee7a321b6
8
sw.js
8
sw.js
@ -15,7 +15,7 @@ function registerWasmHTTPListener(wasm, base, args) {
|
||||
let path = new URL(registration.scope).pathname
|
||||
if (base && base !== '') path = `${trimEnd(path, '/')}/${trimStart(base, '/')}`
|
||||
|
||||
addEventListener('fetch', async e => {
|
||||
addEventListener('fetch', e => {
|
||||
console.log("new fetch !")
|
||||
|
||||
const { pathname } = new URL(e.request.url)
|
||||
@ -29,11 +29,7 @@ function registerWasmHTTPListener(wasm, base, args) {
|
||||
// FIXME await ? catch ?
|
||||
startWasm(wasm, { env: { WASMHTTP_HANDLER_ID: handlerId, WASMHTTP_PATH: path }, args })
|
||||
|
||||
const handler = await handlerPromise
|
||||
|
||||
console.log({ handler })
|
||||
|
||||
e.respondWith(handler(e.request))
|
||||
e.respondWith(handlerPromise.then(handler => handler(e.request)))
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user