Skip to content

Instantly share code, notes, and snippets.

@wperron
Created June 11, 2021 18:12
Show Gist options
  • Save wperron/63103094d7d7586f17ffd13c6a39e6d3 to your computer and use it in GitHub Desktop.
Save wperron/63103094d7d7586f17ffd13c6a39e6d3 to your computer and use it in GitHub Desktop.
addEventListener("fetch", (event) => {
event.respondWith(handler(event.request));
});
async function handler(req: Request): Promise<Response> {
if (typeof BroadcastChannel !== "undefined") {
console.log("found broadcast channel");
return new Response("true");
}
return new Response("false");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment