diff --git a/src/client/location.ts b/src/client/location.ts index 42058aa..15a6158 100644 --- a/src/client/location.ts +++ b/src/client/location.ts @@ -1,17 +1,12 @@ // @ts-nocheck import { encodeUrl, decodeUrl } from "../shared"; -function urlLocation() { - const loc = new URL(decodeUrl(location.href)); - loc.assign = (url: string) => location.assign(encodeUrl(url)); - loc.reload = () => location.reload(); - loc.replace = (url: string) => location.replace(encodeUrl(url)); - loc.toString = () => loc.href; +const loc = new URL(decodeUrl(location.href)); +loc.assign = (url: string) => location.assign(encodeUrl(url)); +loc.reload = () => location.reload(); +loc.replace = (url: string) => location.replace(encodeUrl(url)); +loc.toString = () => loc.href; - return loc; -} - -const loc = urlLocation(); export const locationProxy = new Proxy(window.location, { get(target, prop) { return loc[prop];