Skip to content

Commit

Permalink
Do I need to add a lint rule for safe object access ffs
Browse files Browse the repository at this point in the history
  • Loading branch information
wearrrrr committed Oct 27, 2024
1 parent 990b9c8 commit 2db203a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions static/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ self.addEventListener("message", ({ data }) => {

scramjet.addEventListener("request", (e) => {
let headers = {};
if (e.url.href === playgroundData.origin + "/") {
if (playgroundData && e.url.href === playgroundData.origin + "/") {
headers["content-type"] = "text/html";
e.response = new Response(playgroundData.html, {
headers,
});
} else if (e.url.href === playgroundData.origin + "/style.css") {
} else if (playgroundData && e.url.href === playgroundData.origin + "/style.css") {
headers["content-type"] = "text/css";
e.response = new Response(playgroundData.css, {
headers,
});
} else if (e.url.href === playgroundData.origin + "/script.js") {
} else if (playgroundData && e.url.href === playgroundData.origin + "/script.js") {
headers["content-type"] = "application/javascript";
e.response = new Response(playgroundData.js, {
headers,
Expand Down

0 comments on commit 2db203a

Please sign in to comment.