foreign_office 0.16.4 → 0.16.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77219be0b6f0adad7d1b68edd0ec7abd28b5ef80
4
- data.tar.gz: c98acaf6aa806d3132074c1596ff036c55e44358
3
+ metadata.gz: b08bb9e93823d0150d00b9e4c82691e43372cb8c
4
+ data.tar.gz: 7e0daf42d8e983a4d62d032670bca7679f2d1c4b
5
5
  SHA512:
6
- metadata.gz: 466e2ea1cde10ede2cc8731aca6dad396946a89d10f49a61121fa2099dfae3150af627e0d48b5e0412dbe484a2e81b086528ae2b5444c04732ab0bba8ea1adb5
7
- data.tar.gz: 0237ed66f10cb2af09b4ce6aeaed3ecac7676a6c025696ee897a03bd938c088baab04d7fada6e6f8ceba7533d2ab5ecced9b074351c293ef4e3116f6551d92aa
6
+ metadata.gz: 9c80c506ecb46cb0b1200d5c06fe0febfabaee082f7f2271f33c2c4187d4bc47befe06cc50a04f57332749bc2488187c6fe7a4280da256bd0b79731cd467fb7f
7
+ data.tar.gz: 54e15cb61e12427c501b9ca5fe6ff27cc1596c7af5ae25414da1daa62d275fc5f9c4133fa2d1e4198cb2702ae14058031861251f30b21523281ed603f00f14c1
@@ -25,6 +25,7 @@ var ForeignOffice = Class.extend({
25
25
  }
26
26
  debug_logger.log("Connecting to message bus using " + bus_class_name, 1, 'foreign-office')
27
27
  this.bus = new bus_class(config);
28
+ this.bus.bind_state_change()
28
29
  if(typeof config.disconnect_alert != 'undefined'){
29
30
  this.disconnect_alert = config.disconnect_alert
30
31
  } else {
@@ -13,6 +13,24 @@ var PusherBus = Class.extend({
13
13
  },
14
14
  get_channel_name: function(channel_name){
15
15
  return channel_name.replace(/::/g, '.')
16
+ },
17
+ bind_state_change: function(){
18
+ this.pusher.connection.bind('state_change', function(states){
19
+ if(states.previous === "connected" && states.current === "connecting"){
20
+ reload_page();
21
+ }
22
+ });
23
+ this.pusher.connection.bind('disconnected', function(){
24
+ reload_page();
25
+ });
16
26
  }
17
- })
27
+
28
+ });
29
+
30
+ var reload_page = function(){
31
+ if (
32
+ window.confirm('The pusher connection has been lost. Click ok to refresh the page.')
33
+ ) { window.location.reload()}
34
+ };
35
+
18
36
  PusherBus.third_party_library = 'Pusher'
@@ -1,3 +1,3 @@
1
1
  module ForeignOffice
2
- VERSION = "0.16.4"
2
+ VERSION = "0.16.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreign_office
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.4
4
+ version: 0.16.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-06-12 00:00:00.000000000 Z
12
+ date: 2018-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails