mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-29 12:10:24 +00:00
17 lines
439 B
JavaScript
17 lines
439 B
JavaScript
// src/hooks/use-hash.tsx
|
|
import { useSyncExternalStore } from "react";
|
|
import { suspendIfSsr } from "../utils/react";
|
|
var useHash = () => {
|
|
suspendIfSsr("useHash");
|
|
return useSyncExternalStore(
|
|
(onChange) => {
|
|
const interval = setInterval(() => onChange(), 10);
|
|
return () => clearInterval(interval);
|
|
},
|
|
() => window.location.hash.substring(1)
|
|
);
|
|
};
|
|
export {
|
|
useHash
|
|
};
|
|
//# sourceMappingURL=use-hash.js.map
|