Skip to content

Commit 38c1814

Browse files
committed
refactor: change signature for passthrough function
1 parent 268c971 commit 38c1814

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sw.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function registerWasmHTTPListener(wasm, { base, cacheName, passthroughFunc, args = [] } = {}) {
1+
function registerWasmHTTPListener(wasm, { base, cacheName, passthrough, args = [] } = {}) {
22
let path = new URL(registration.scope).pathname
33
if (base && base !== '') path = `${trimEnd(path, '/')}/${trimStart(base, '/')}`
44

@@ -17,10 +17,11 @@ function registerWasmHTTPListener(wasm, { base, cacheName, passthroughFunc, args
1717
WebAssembly.instantiateStreaming(source, go.importObject).then(({ instance }) => go.run(instance))
1818

1919
addEventListener('fetch', e => {
20-
if (passthroughFunc && passthroughFunc(e.request)) {
20+
if (passthrough?.(e.request)) {
2121
e.respondWith(fetch(e.request))
2222
return;
2323
}
24+
2425
const { pathname } = new URL(e.request.url)
2526
if (!pathname.startsWith(path)) return
2627

0 commit comments

Comments
 (0)