18 lines
304 B
TypeScript
18 lines
304 B
TypeScript
|
import { writable } from "svelte/store";
|
||
|
|
||
|
let r = "main";
|
||
|
|
||
|
if (window.location.hash.length) {
|
||
|
r = window.location.hash.replace("#", "");
|
||
|
} else {
|
||
|
r = "main";
|
||
|
}
|
||
|
|
||
|
const store = writable<string>(r);
|
||
|
|
||
|
store.subscribe(s => {
|
||
|
if (s === "main") s = ""
|
||
|
window.location.hash = s;
|
||
|
})
|
||
|
|
||
|
export default store;
|