summaryrefslogtreecommitdiff
path: root/src/content/papo.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/papo.js')
-rw-r--r--src/content/papo.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/content/papo.js b/src/content/papo.js
new file mode 100644
index 0000000..83dd1b1
--- /dev/null
+++ b/src/content/papo.js
@@ -0,0 +1,34 @@
+// import * as assert from "node:assert/strict";
+
+
+// assert.deepEqual({a: 1}, {a: 1});
+// console.log(123);
+// console.log({ navigator });
+
+
+const f1 = x => x + 1;
+const f2 = x => x - 1;
+
+const registerServiceWorker = async ({ serviceWorkerPath, err }) => {
+ try {
+ await navigator.serviceWorker?.register(path)
+ } catch (e) {
+ err(`Service worker registration failed: ${e}`);
+ }
+};
+
+export const main = async ({
+ serviceWorkerPath = "./service-worker.js",
+ out = console.log,
+ err = console.warn,
+} = {}) => {
+ const env = {
+ serviceWorkerPath,
+ out,
+ err,
+ };
+ await registerServiceWorker(env);
+ out("main called");
+};
+
+// <body onload="setOnline()" ononline="setOnline()" onoffline="setOnline()" >