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: fallback to xhr for development testing
Date Fri, 08 Jul 2016 17:11:28 GMT
This is an automated email from the ASF dual-hosted git repository.

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

The following commit(s) were added to refs/heads/master by this push:
       new  b61840e   fallback to xhr for development testing
b61840e is described below

commit b61840e161142fe872f22ba19dd14f903cde8848
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Fri Jul 8 13:11:01 2016 -0400

    fallback to xhr for development testing
---
 www/board/agenda/views/models/jsonstorage.js.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/views/models/jsonstorage.js.rb b/www/board/agenda/views/models/jsonstorage.js.rb
index 2e0d69f..760356c 100644
--- a/www/board/agenda/views/models/jsonstorage.js.rb
+++ b/www/board/agenda/views/models/jsonstorage.js.rb
@@ -46,7 +46,10 @@ class JSONStorage
   # other browsers fall back to XMLHttpRequest (AJAX).
   def self.fetch(name, &block)
 
-    if defined? fetch and defined? caches
+    if 
+      defined? fetch and defined? caches and
+      (location.protocol == 'https:' or location.hostname == 'localhost')
+    then
       caches.open('board/agenda').then do |cache|
         fetched = nil
         clock_counter += 1
@@ -74,7 +77,7 @@ class JSONStorage
 
         # check cache
         cache.match(name).then do |response|
-          if not fetched
+          if response and not fetched
             response.json().then do |json| 
               clock_counter -= 1
               fetched = json

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message