Set up a callback to be fired on Window's beforeunload event.
function useBeforeUnload(
callback: (event: BeforeUnloadEvent) => any,
options?: {
capture?: boolean;
},
): void
The callback to be called when the beforeunload event is fired.
If true, the event will be captured during the capture phase. Defaults to false.
No return value.