proxy historystate properly

This commit is contained in:
Percs 2024-07-15 15:15:15 -05:00
parent fecf21ba88
commit 51f7a85fe6

View file

@ -1,8 +1,8 @@
import { decodeUrl } from "./shared";
import { encodeUrl } from "./shared";
window.history.pushState = new Proxy(window.history.pushState, {
apply(target, thisArg, argArray) {
argArray[2] = decodeUrl(argArray[2]);
argArray[2] = encodeUrl(argArray[2]);
return Reflect.apply(target, thisArg, argArray);
},
@ -10,7 +10,7 @@ window.history.pushState = new Proxy(window.history.pushState, {
window.history.replaceState = new Proxy(window.history.replaceState, {
apply(target, thisArg, argArray) {
argArray[2] = decodeUrl(argArray[2]);
argArray[2] = encodeUrl(argArray[2]);
return Reflect.apply(target, thisArg, argArray);
},