From 86e31e911312a7e69ed326c42ce629c0f3da3951 Mon Sep 17 00:00:00 2001 From: chee Date: Thu, 3 Oct 2024 18:35:39 +0100 Subject: [PATCH] say hello when you get here --- public/automerge/collab.js | 10 ++++++++++ public/service-worker.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/public/automerge/collab.js b/public/automerge/collab.js index 12f2fab..891deff 100644 --- a/public/automerge/collab.js +++ b/public/automerge/collab.js @@ -206,6 +206,15 @@ export async function start(url, memtree) { ) firstLoadComplete = true }) + handle.broadcast("hello") + /** + * + * @param {AutomergeRepo.DocHandleEphemeralMessagePayload} payload + */ + function onephemera(payload) { + console.info(payload.message, payload) + } + handle.addListener("ephemeral-message", onephemera) alreadyFancy = true let preventPatchApplications = false let dispose = memtree.listen((kind, index, source) => { @@ -413,6 +422,7 @@ export async function start(url, memtree) { unlisten = () => { dispose() handle.off("change", onchange) + handle.off("ephemeral-message", onephemera) offsoundchanges.forEach(o => o()) } } diff --git a/public/service-worker.js b/public/service-worker.js index 60b5d16..d7ba116 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,6 +1,6 @@ /// // update this when changing the service worker -const SERVICE_WORKER_VERSION = "v21" +const SERVICE_WORKER_VERSION = "v22" const addResourcesToCache = async resources => { const cache = await caches.open(SERVICE_WORKER_VERSION)