Skip to content

Commit

Permalink
update service worker sooner
Browse files Browse the repository at this point in the history
  • Loading branch information
maxence-charriere committed Oct 2, 2024
1 parent f5f2689 commit b242351
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion pkg/app/gen/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ let deferredPrompt = null;
goappInitServiceWorker();
goappWatchForUpdate();
goappWatchForInstallable();
goappInitWebAssembly();

// -----------------------------------------------------------------------------
// Service Worker
Expand Down
9 changes: 2 additions & 7 deletions pkg/app/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (h *Handler) initPWAResources() {
h.cachedPWAResources.Set(cacheItem{
Path: "/wasm_exec.js",
ContentType: "application/javascript",
Body: []byte(wasmExecJS()),
Body: []byte(wasmExecJS() + "\ngoappInitWebAssembly()"),
})

h.cachedPWAResources.Set(cacheItem{
Expand Down Expand Up @@ -648,9 +648,6 @@ func (h *Handler) servePage(w http.ResponseWriter, r *http.Request) {
Meta().
Name("viewport").
Content("width=device-width, initial-scale=1, viewport-fit=cover"),
Meta().
Name("apple-mobile-web-app-capable").
Content("yes"),
Meta().
Property("og:url").
Content(resolveOGResource(h.Domain, h.Resources.Resolve(page.URL().Path))),
Expand Down Expand Up @@ -726,12 +723,10 @@ func (h *Handler) servePage(w http.ResponseWriter, r *http.Request) {
}
return nil
}),
Script().Src("/app.js"),
Script().
Defer(true).
Src("/wasm_exec.js"),
Script().
Defer(true).
Src("/app.js"),
Range(h.Scripts).Slice(func(i int) UI {
if resource := parseHTTPResource(h.Scripts[i]); resource.URL != "" {
return resource.toScript()
Expand Down
Loading

0 comments on commit b242351

Please sign in to comment.