whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: force serviceworker reload on change
Date Tue, 05 Jun 2018 00:59:19 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 971110b  force serviceworker reload on change
971110b is described below

commit 971110b1c80c7c55cc77041372542a0a1186ea40
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Jun 4 20:58:55 2018 -0400

    force serviceworker reload on change
---
 www/board/agenda/routes.rb                    | 1 +
 www/board/agenda/views/models/pagecache.js.rb | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 9e663dd..21d8c86 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -196,6 +196,7 @@ get %r{/(\d\d\d\d-\d\d-\d\d)/(.*)} do |date, path|
 
   @cssmtime = File.mtime('public/stylesheets/app.css').to_i
   @appmtime = Wunderbar::Asset.convert("#{settings.views}/app.js.rb").mtime.to_i
+  @server[:swmtime] = File.mtime("#{settings.views}/sw.js.rb").to_i
 
   if path == 'bootstrap.html'
     unless env.password
diff --git a/www/board/agenda/views/models/pagecache.js.rb b/www/board/agenda/views/models/pagecache.js.rb
index 0ee6c0d..873fc66 100644
--- a/www/board/agenda/views/models/pagecache.js.rb
+++ b/www/board/agenda/views/models/pagecache.js.rb
@@ -41,7 +41,8 @@ class PageCache
   def self.register()
     # register service worker
     scope = URL.new('..', document.getElementsByTagName('base')[0].href)
-    navigator.serviceWorker.register(scope + 'sw.js', scope).then do
+    swjs = "#{scope}sw.js?#{Server.swmtime}"
+    navigator.serviceWorker.register(swjs, scope).then do
       # watch for reload requests from the service worker
       navigator.serviceWorker.addEventListener 'message' do |event|
         if event.data.type == 'reload'

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.

Mime
View raw message