import { on } from "../events/index.js";
import { isLike, ok } from "../is.js";
import { isMainThread } from "node:worker_threads";
import { isServiceWorker } from "../worker/service-worker/config.js";
export const FETCH = "fetch";
function isFetchEvent(event) {
    return !!(isLike(event) &&
        event.type === FETCH &&
        event.request &&
        event.respondWith);
}
export let removeFetchScheduledFunction = () => { };
if (isMainThread && !isServiceWorker()) {
    removeFetchScheduledFunction = on(FETCH, async (event) => {
        console.log("FETCHING!");
        ok(isFetchEvent(event));
        event.respondWith(fetch(event.request.clone()));
    });
}
//# sourceMappingURL=events.js.map