MCPcopy Create free account
hub / github.com/dailydotdev/apps / onPopState

Function onPopState

packages/shared/src/hooks/useCloseOnBack.ts:65–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 const pageKey = key.current;
64 releasing.current = new Promise<void>((resolve) => {
65 const onPopState = () => {
66 globalThis.removeEventListener('popstate', onPopState);
67 router.beforePopState(() => true);
68 releasing.current = null;
69 resolve();
70 };
71 // The page is already showing: Next must not route to it again.
72 router.beforePopState(
73 (state) => (state as HistoryState)?.key !== pageKey,

Callers

nothing calls this directly

Calls 3

resolveFunction · 0.85
historyStateFunction · 0.85
beforePopStateMethod · 0.80

Tested by

no test coverage detected