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.
@@ -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(window.history.state?.targetHref || window.location.href);
174
- const event = new CustomEvent("spa-popstate", {
181
+ await getNewPageContent(url);
182
+ const updatedEvent = new CustomEvent("spa-popstate-updated", {
175
183
  detail: {
176
- href: window.history.state?.targetHref || window.location.href
184
+ href: url,
185
+ url: safeParseURL(url)
177
186
  }
178
187
  });
179
- window.dispatchEvent(event);
188
+ window.dispatchEvent(updatedEvent);
180
189
  }
181
190
  function isRelativeURL(url) {
182
191
  if (typeof url !== "string") return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpine",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "main": "dist/index.js",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-secrets-manager": "^3.758.0",