xpine 0.0.38 → 0.0.40
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 +13 -4
- package/package.json +1 -1
package/dist/src/static/spa.js
CHANGED
|
@@ -169,14 +169,23 @@ function replaceAttributesOnDocumentBody(dom) {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
async function handleBackButton() {
|
|
172
|
+
const url = window.history.state?.targetHref || window.location.href;
|
|
173
|
+
const initEvent = new CustomEvent("spa-popstate-initiated", {
|
|
174
|
+
detail: {
|
|
175
|
+
href: url,
|
|
176
|
+
url: safeParseURL(url)
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
window.dispatchEvent(initEvent);
|
|
172
180
|
if (window.xpineIgnorePopState) return;
|
|
173
|
-
await getNewPageContent(
|
|
174
|
-
const
|
|
181
|
+
await getNewPageContent(url);
|
|
182
|
+
const updatedEvent = new CustomEvent("spa-popstate-updated", {
|
|
175
183
|
detail: {
|
|
176
|
-
href:
|
|
184
|
+
href: url,
|
|
185
|
+
url: safeParseURL(url)
|
|
177
186
|
}
|
|
178
187
|
});
|
|
179
|
-
window.dispatchEvent(
|
|
188
|
+
window.dispatchEvent(updatedEvent);
|
|
180
189
|
}
|
|
181
190
|
function isRelativeURL(url) {
|
|
182
191
|
if (typeof url !== "string") return false;
|