mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-16 07:30:02 -04:00
fix: history proxy
This commit is contained in:
parent
7c55b59e5a
commit
d632041355
1 changed files with 4 additions and 2 deletions
|
@ -5,7 +5,8 @@ import { UrlChangeEvent } from "../events";
|
||||||
export default function (client: ScramjetClient, self: typeof globalThis) {
|
export default function (client: ScramjetClient, self: typeof globalThis) {
|
||||||
client.Proxy("History.prototype.pushState", {
|
client.Proxy("History.prototype.pushState", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (ctx.args[2]) ctx.args[2] = rewriteUrl(ctx.args[2], client.meta);
|
if (ctx.args[2] || ctx.args[2] === "")
|
||||||
|
ctx.args[2] = rewriteUrl(ctx.args[2], client.meta);
|
||||||
ctx.call();
|
ctx.call();
|
||||||
|
|
||||||
const ev = new UrlChangeEvent(client.url.href);
|
const ev = new UrlChangeEvent(client.url.href);
|
||||||
|
@ -15,7 +16,8 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
|
||||||
|
|
||||||
client.Proxy("History.prototype.replaceState", {
|
client.Proxy("History.prototype.replaceState", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (ctx.args[2]) ctx.args[2] = rewriteUrl(ctx.args[2], client.meta);
|
if (ctx.args[2] || ctx.args[2] === "")
|
||||||
|
ctx.args[2] = rewriteUrl(ctx.args[2], client.meta);
|
||||||
ctx.call();
|
ctx.call();
|
||||||
|
|
||||||
const ev = new UrlChangeEvent(client.url.href);
|
const ev = new UrlChangeEvent(client.url.href);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue