Home > @theweave/api > WeaveServices > onBeforeUnload
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;