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,19 +1,13 @@
|
|||
// @ts-nocheck
|
||||
import { encodeUrl, decodeUrl } from "../shared";
|
||||
|
||||
function urlLocation() {
|
||||
export function LocationProxy() {
|
||||
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;
|
||||
}
|
||||
|
||||
export function LocationProxy() {
|
||||
const loc = urlLocation();
|
||||
|
||||
return new Proxy(window.location, {
|
||||
get(target, prop) {
|
||||
return loc[prop];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue