useBeforeUnload
On this page

useBeforeUnload

Summary

Reference Documentation ↗

Set up a callback to be fired on Window's beforeunload event.

Signature

function useBeforeUnload(
  callback: (event: BeforeUnloadEvent) => any,
  options?: {
    capture?: boolean;
  },
): void

Params

callback

The callback to be called when the beforeunload event is fired.

options.capture

If true, the event will be captured during the capture phase. Defaults to false.

Returns

No return value.

Docs and examples CC 4.0
Edit