mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
clean up location proxy
This commit is contained in:
parent
4ce4226afa
commit
38f7a5e5a7
1 changed files with 1 additions and 7 deletions
|
@ -1,18 +1,12 @@
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { encodeUrl, decodeUrl } from "../shared";
|
import { encodeUrl, decodeUrl } from "../shared";
|
||||||
|
|
||||||
function urlLocation() {
|
export function LocationProxy() {
|
||||||
const loc = new URL(decodeUrl(location.href));
|
const loc = new URL(decodeUrl(location.href));
|
||||||
loc.assign = (url: string) => location.assign(encodeUrl(url));
|
loc.assign = (url: string) => location.assign(encodeUrl(url));
|
||||||
loc.reload = () => location.reload();
|
loc.reload = () => location.reload();
|
||||||
loc.replace = (url: string) => location.replace(encodeUrl(url));
|
loc.replace = (url: string) => location.replace(encodeUrl(url));
|
||||||
loc.toString = () => loc.href;
|
loc.toString = () => loc.href;
|
||||||
|
|
||||||
return loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function LocationProxy() {
|
|
||||||
const loc = urlLocation();
|
|
||||||
|
|
||||||
return new Proxy(window.location, {
|
return new Proxy(window.location, {
|
||||||
get(target, prop) {
|
get(target, prop) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue