@jon49/sw 0.12.12 → 0.12.14

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.
@@ -4,8 +4,8 @@ let refreshing = false
4
4
  // Here we reload the page
5
5
  navigator.serviceWorker.addEventListener('controllerchange', function () {
6
6
  if (refreshing) return
7
- window.location.reload()
8
7
  refreshing = true
8
+ window.location.reload()
9
9
  })
10
10
 
11
11
  /// Checks if there is a new version of the app available
package/lib/routes.ts CHANGED
@@ -1,5 +1,6 @@
1
- // @ts-ignore
2
- let links: { file: string, url: string }[] | undefined = self.app?.links
1
+ let { html, links } =
2
+ // @ts-ignore
3
+ self.app as { links: { file: string, url: string }[], html: Function }
3
4
 
4
5
  if (!links) {
5
6
  console.error("Expecting links defined with `self.app.links`, but found none.")
@@ -174,6 +175,10 @@ async function executeHandler({ url, req, event }: ExectuteHandlerOptions) : Pro
174
175
  }
175
176
 
176
177
  if (isHtml(result)) {
178
+ if (req.url.includes("hz")) {
179
+ result = html`<template>${result}</template>`
180
+ }
181
+
177
182
  return streamResponse({
178
183
  body: result,
179
184
  headers: htmfHeader(req, null, messages)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jon49/sw",
3
- "version": "0.12.12",
3
+ "version": "0.12.14",
4
4
  "description": "Packages for MVC service workers.",
5
5
  "type": "module",
6
6
  "files": [