Files
SnowLuma/.pnpm-store/v11/files/60/ecf7cc66d82794a44e625b844595bf340ade93fbd38da31d31261230d995c844e6c7e987b5ce6fddbabf466051be59d6b90c17daf4ba00524aa7a82740e460
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

17 lines
532 B
Plaintext

//#region src/adapter/service-worker/handler.ts
/**
* Adapter for Service Worker
* @deprecated `hono/service-worker` will be removed in v5. Install `@hono/service-worker` and import from there instead.
*/
const handle = (app, opts = { fetch: globalThis.fetch.bind(globalThis) }) => {
return (evt) => {
evt.respondWith((async () => {
const res = await app.fetch(evt.request, {}, evt);
if (opts.fetch && res.status === 404) return await opts.fetch(evt.request);
return res;
})());
};
};
//#endregion
export { handle };