UNPKG

@agnos-ui/core

Version:

Framework-agnostic headless component library.

16 lines (15 loc) 406 B
import { readable } from "@amadeus-it-group/tansu"; const hash$ = readable("", { onUse({ set }) { function handleHashChange() { const hash = location.hash; set(hash ? hash.substring(1) : ""); } handleHashChange(); window.addEventListener("hashchange", handleHashChange); return () => window.removeEventListener("hashchange", handleHashChange); } }); export { hash$ };