xpine 0.0.39 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/static/spa.js +8 -4
- package/package.json +1 -1
package/dist/src/static/spa.js
CHANGED
|
@@ -27,7 +27,8 @@ async function updatePageOnLinkClick(e) {
|
|
|
27
27
|
window.history.pushState(
|
|
28
28
|
{
|
|
29
29
|
type: "link-click",
|
|
30
|
-
targetHref
|
|
30
|
+
href: targetHref,
|
|
31
|
+
url: newURL
|
|
31
32
|
},
|
|
32
33
|
"",
|
|
33
34
|
targetHref
|
|
@@ -169,17 +170,20 @@ function replaceAttributesOnDocumentBody(dom) {
|
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
async function handleBackButton() {
|
|
173
|
+
const url = window.history.state?.url?.href || window.location.href;
|
|
172
174
|
const initEvent = new CustomEvent("spa-popstate-initiated", {
|
|
173
175
|
detail: {
|
|
174
|
-
href:
|
|
176
|
+
href: url,
|
|
177
|
+
url: safeParseURL(url)
|
|
175
178
|
}
|
|
176
179
|
});
|
|
177
180
|
window.dispatchEvent(initEvent);
|
|
178
181
|
if (window.xpineIgnorePopState) return;
|
|
179
|
-
await getNewPageContent(
|
|
182
|
+
await getNewPageContent(url);
|
|
180
183
|
const updatedEvent = new CustomEvent("spa-popstate-updated", {
|
|
181
184
|
detail: {
|
|
182
|
-
href:
|
|
185
|
+
href: url,
|
|
186
|
+
url: safeParseURL(url)
|
|
183
187
|
}
|
|
184
188
|
});
|
|
185
189
|
window.dispatchEvent(updatedEvent);
|