Files
SnowLuma/.pnpm-store/v11/files/08/46232211afcf661681b8fe99c2cedffc9381de469faa9995db91f9faf737fc519a4bd526794e15cc382dc9aaf4a36ce8eb740fd2556d0d6c0a6f0dda999ff1
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

26 lines
675 B
Plaintext

import { handle } from "./handler.js";
//#region src/adapter/service-worker/index.ts
/**
* Registers a Hono app to handle fetch events in a service worker.
* This sets up `addEventListener('fetch', handle(app, options))` for the provided app.
*
* @param app - The Hono application instance
* @param options - Options for handling requests (fetch defaults to undefined)
* @example
* ```ts
* import { Hono } from 'hono'
* import { fire } from 'hono/service-worker'
*
* const app = new Hono()
*
* app.get('/', (c) => c.text('Hi'))
*
* fire(app)
* ```
*/
const fire = (app, options) => {
addEventListener("fetch", handle(app, options));
};
//#endregion
export { fire, handle };