diff --git a/docs/api-reference/api/api.parenttoappletmessage.md b/docs/api-reference/api/api.parenttoappletmessage.md
index 9f79777d..f53ed472 100644
--- a/docs/api-reference/api/api.parenttoappletmessage.md
+++ b/docs/api-reference/api/api.parenttoappletmessage.md
@@ -24,6 +24,8 @@ export type ParentToAppletMessage = {
} | {
type: 'peer-status-update';
payload: PeerStatusUpdate;
+} | {
+ type: 'on-before-unload';
};
```
**References:** [WAL](./api.wal.md), [RecordInfo](./api.recordinfo.md), [PeerStatusUpdate](./api.peerstatusupdate.md)
diff --git a/docs/api-reference/api/api.weaveclient.md b/docs/api-reference/api/api.weaveclient.md
index 834214a7..745be574 100644
--- a/docs/api-reference/api/api.weaveclient.md
+++ b/docs/api-reference/api/api.weaveclient.md
@@ -169,6 +169,23 @@ Description
+ |
+
+
+[onBeforeUnload](./api.weaveclient.onbeforeunload.md)
+
+
+ |
+
+
+ |
+
+(callback: () => any) => [UnsubscribeFunction](./api.unsubscribefunction.md)
+
+
+ |
+
+
|
diff --git a/docs/api-reference/api/api.weaveclient.onbeforeunload.md b/docs/api-reference/api/api.weaveclient.onbeforeunload.md
new file mode 100644
index 00000000..43a67e4f
--- /dev/null
+++ b/docs/api-reference/api/api.weaveclient.onbeforeunload.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [@theweave/api](./api.md) > [WeaveClient](./api.weaveclient.md) > [onBeforeUnload](./api.weaveclient.onbeforeunload.md)
+
+## WeaveClient.onBeforeUnload property
+
+**Signature:**
+
+```typescript
+onBeforeUnload: (callback: () => any) => UnsubscribeFunction;
+```
diff --git a/docs/api-reference/api/api.weaveservices.md b/docs/api-reference/api/api.weaveservices.md
index 215af00f..68451020 100644
--- a/docs/api-reference/api/api.weaveservices.md
+++ b/docs/api-reference/api/api.weaveservices.md
@@ -182,6 +182,27 @@ Gets the group permission type. May be used to restrict certain actions in the U
Sends notifications to We and depending on user settings and urgency level further to the operating system.
+ |
+
+
+[onBeforeUnload](./api.weaveservices.onbeforeunload.md)
+
+
+ |
+
+
+ |
+
+(callback: () => void) => [UnsubscribeFunction](./api.unsubscribefunction.md)
+
+
+ |
+
+Event listener allowing to register a callback that will get executed before the applet gets reloaded, for example to save intermediate user input (e.g. commit the most recent changes of a document to the source chain).
+
+If this callback takes too long, users may be offered to force reload, thereby ignoring/cancelling the pending callback.
+
+
|
diff --git a/docs/api-reference/api/api.weaveservices.onbeforeunload.md b/docs/api-reference/api/api.weaveservices.onbeforeunload.md
new file mode 100644
index 00000000..b79ea6c2
--- /dev/null
+++ b/docs/api-reference/api/api.weaveservices.onbeforeunload.md
@@ -0,0 +1,15 @@
+
+
+[Home](./index.md) > [@theweave/api](./api.md) > [WeaveServices](./api.weaveservices.md) > [onBeforeUnload](./api.weaveservices.onbeforeunload.md)
+
+## WeaveServices.onBeforeUnload property
+
+Event listener allowing to register a callback that will get executed before the applet gets reloaded, for example to save intermediate user input (e.g. commit the most recent changes of a document to the source chain).
+
+If this callback takes too long, users may be offered to force reload, thereby ignoring/cancelling the pending callback.
+
+**Signature:**
+
+```typescript
+onBeforeUnload: (callback: () => void) => UnsubscribeFunction;
+```
diff --git a/docs/build/moss-sugar.md b/docs/build/moss-sugar.md
index cb9196e7..4e28cf3a 100644
--- a/docs/build/moss-sugar.md
+++ b/docs/build/moss-sugar.md
@@ -9,7 +9,7 @@ Now that the holochain app works outside Moss, let's add some Weave/Moss specifi
The Weave dev CLI will allow you to run yor Tool in a sandboxed instance of Moss with hot-reloading. Install it as a dev dependency:
```bash
-npm install -d @theweave/cli@0.13.0-beta.6
+npm install -d @theweave/cli@0.13.0-gamma.5
```
### Weave Client
@@ -19,5 +19,5 @@ npm install -d @theweave/cli@0.13.0-beta.6
The Weave API npm package will allow your Tool's frontend to interact with Moss using the `WeaveClient` class. Install it into the workspace of your frontend code:
```bash
-npm install -w ui @theweave/api@0.1.0
+npm install -w ui @theweave/api@0.2.1
```
diff --git a/example/ui/src/elements/wal-embed-debug.ts b/example/ui/src/elements/wal-embed-debug.ts
index a859fe4b..603b9ec1 100644
--- a/example/ui/src/elements/wal-embed-debug.ts
+++ b/example/ui/src/elements/wal-embed-debug.ts
@@ -13,6 +13,7 @@ import {
WeaveClient,
} from '@theweave/api';
import '@shoelace-style/shoelace/dist/components/spinner/spinner.js';
+import '@shoelace-style/shoelace/dist/components/tooltip/tooltip.js';
import { appletOrigin, urlFromAppletHash } from '@theweave/elements';
import { sharedStyles, wrapPathInSvg } from '@holochain-open-dev/elements';
import { DnaHash, EntryHash } from '@holochain/client';
|