Skip to content

Commit

Permalink
Merge branch 'main' into dev-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-sg committed Nov 30, 2023
2 parents e9e2926 + d25872e commit 3056ec7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Yarn Install
run: yarn install --frozen-lockfile

- name: Yarn Build
run: yarn build

Expand Down
29 changes: 29 additions & 0 deletions src/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import INDEX_HTML from "../index.html";

import { SWReplay } from "@webrecorder/wabac/src/swmain";

import { WorkerLoader } from "@webrecorder/wabac/src/loaders";

if (self.registration) {
const staticData = new Map();

const prefix = self.registration.scope;

staticData.set(prefix, { type: "text/html", content: INDEX_HTML });
staticData.set(prefix + "index.html", {
type: "text/html",
content: INDEX_HTML,
});

const sp = new URLSearchParams(self.location.search);

const defaultConfig = {};

if (sp.get("ruffle") == "1") {
defaultConfig.injectScripts = ["ruffle/ruffle.js"];
}

self.sw = new SWReplay({ staticData, defaultConfig });
} else {
new WorkerLoader(self);
}

0 comments on commit 3056ec7

Please sign in to comment.