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 7598ca5  add map file
7598ca5 is described below

commit 7598ca53b7db9677a22df9e21811e97f818a745e
Author: Sam Ruby <[email protected]>
AuthorDate: Sun Nov 19 16:53:58 2017 -0500

    add map file
---
 www/assets/bootstrap-theme.min.css.map        |  1 +
 www/board/agenda/views/models/pagecache.js.rb |  4 +++-
 www/board/agenda/views/models/pending.js.rb   | 31 +++++++++++++++++++--------
 3 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/www/assets/bootstrap-theme.min.css.map 
b/www/assets/bootstrap-theme.min.css.map
new file mode 100755
index 0000000..94813e9
--- /dev/null
+++ b/www/assets/bootstrap-theme.min.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["less/theme.less","less/mixins/vendor-prefixes.less","less/mixins/gradients.less","less/mixins/reset-filter.less"],"names":[],"mappings":";;;;AAmBA,YAAA,aAAA,UAAA,aAAA,aAAA,aAME,YAAA,EAAA,KAAA,EAAA,eC2CA,mBAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBDvCR,mBAAA,mBAAA,oBAAA,oBAAA,iBAAA,iBAAA,oBAAA,oBAAA,oBAAA,oBAAA,oBAAA,oBCsCA,mBAAA,MAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,iBDlCR,qBAAA,sBAAA,sBAAA,uBA
 [...]
\ No newline at end of file
diff --git a/www/board/agenda/views/models/pagecache.js.rb 
b/www/board/agenda/views/models/pagecache.js.rb
index 253c908..08f4c94 100644
--- a/www/board/agenda/views/models/pagecache.js.rb
+++ b/www/board/agenda/views/models/pagecache.js.rb
@@ -15,6 +15,8 @@ class PageCache
       return false
     end
 
+    return false unless defined?(ServiceWorker) and defined?(navigator)
+
     # disable service workers for the production server(s) for now.  See:
     # https://lists.w3.org/Archives/Public/public-webapps/2016JulSep/0016.html
     if location.hostname =~ /^whimsy.*\.apache\.org$/
@@ -30,7 +32,7 @@ class PageCache
       end
     end
 
-    defined?(ServiceWorker) and defined?(navigator)
+    return true
   end
 
   # registration and related startup actions
diff --git a/www/board/agenda/views/models/pending.js.rb 
b/www/board/agenda/views/models/pending.js.rb
index a7cacff..191bf36 100644
--- a/www/board/agenda/views/models/pending.js.rb
+++ b/www/board/agenda/views/models/pending.js.rb
@@ -8,18 +8,31 @@ class Pending
 
   # fetch pending from server (needed for ServiceWorkers)
   def self.fetch()
-    fetch('pending.json', credentials: 'include').then do |response|
-      if response.ok
-        response.json().then do |json|
-          Pending.load(json)
-          if json
-            Server.userid = json.userid if json.userid
-            Server.initials = json.initials if json.initials
-            Server.firstname = json.firstname if json.firstname
-            Server.username = json.firstname if json.username
+    caches.open('board/agenda').then do |cache|
+      fetched = false
+      request = Request.new('pending.json', method: 'get',
+        credentials: 'include', headers: {'Accept' => 'application/json'})
+
+      # use data from last cache until a response is received
+      cache.match("../json/#{name}").then do |response|
+        if response and not fetched
+          response.json().then do |json| 
+           Pending.load(json)
           end
         end
       end
+
+      # update with the lastest once available
+      fetch(request).then do |response|
+       if response.ok
+          cache.put(request, response.clone())
+
+         response.json().then do |json|
+            fetched = true
+           Pending.load(json)
+         end
+       end
+      end
     end
   end
 

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to