Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

useBeforeUnload

Setup a callback to be fired on the window's beforeunload event. This is useful for saving some data to window.localStorage just before the page refreshes.

Note: The callback argument should be a function created with React.useCallback().

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

§Parameters

§
callback: (event: BeforeUnloadEvent) => any
[src]
§
options?: {
capture?: boolean;
}
optional
[src]

§Return Type