This commit is contained in:
Percs 2024-07-16 17:42:21 -05:00
parent fa779017ad
commit d6dd1d4ca3
20 changed files with 363 additions and 379 deletions

View file

@ -11,24 +11,27 @@ function createLocation() {
return loc;
}
export const locationProxy = new Proxy({
host: ""
}, {
get(target, prop) {
const loc = createLocation();
return loc[prop];
export const locationProxy = new Proxy(
{
host: "",
},
{
get(target, prop) {
const loc = createLocation();
set(obj, prop, value) {
const loc = createLocation();
return loc[prop];
},
if (prop === "href") {
location.href = encodeUrl(value);
} else {
loc[prop] = value;
}
set(obj, prop, value) {
const loc = createLocation();
return true;
},
});
if (prop === "href") {
location.href = encodeUrl(value);
} else {
loc[prop] = value;
}
return true;
},
}
);