foreign_office 0.7.0 → 0.7.1

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: e607b876892172ef11ee3dfc659ba5834ce1ec91
4
- data.tar.gz: 539b25bdc3f9d4cc9460c76cfa93409231e23042
3
+ metadata.gz: ffa19274a9c4f956525240daf76d9fff4b59baa5
4
+ data.tar.gz: ca6e62d10fc74ae7bcea1274627e79ae87af8e14
5
5
  SHA512:
6
- metadata.gz: cff5a2eaa2a31204e457c4aa4d4d8afcd90b5337c4ef38c104e7f4b089395d4a611790652c97c7bcb5d21d8c10d10e96b2e450b5655db80e6f5ad6003a99c840
7
- data.tar.gz: a9f16d86b53bbc089ed848a50d7ae0396c232c9b352fc8f7685d0414bd2e6ece9970d01530b45494a2d2f0c4df6dfc59c76592cec3b874078c4329e2ee149ee3
6
+ metadata.gz: a90ad073122328872eb22db38205dde687f70ea3c69a5a218fbea4014107418e2715c8baf1af198b4d1d87dba4646755703a3e24bef9bbd443edf32f35376a86
7
+ data.tar.gz: 0b16680cbb1ecd2529392ecc48a53b59267475a7a47d901f2de47822da99d2b1bce1d1231bf08b296a876dfc2ddf58015d7e46d53a160b49b93e01e070556ddd
@@ -23,17 +23,33 @@ var ForeignOffice = Class.extend({
23
23
  var listener_class = eval(getSubClass($listener.data('listener'),'ForeignOfficeListener'));
24
24
  var listener = new listener_class($listener);
25
25
  var this_channel;
26
- if($.inArray(listener.channel,this.channelNames()) == -1){
26
+ var this_foreign_office = this;
27
+ if($.inArray(listener.channel,this_foreign_office.channelNames()) == -1){
27
28
  this_channel = new ForeignOfficeChannel(listener.channel)
28
- this.channels.push(this_channel);
29
- this.channels_by_name[listener.channel] = this_channel;
29
+ this_foreign_office.channels.push(this_channel);
30
+ this_foreign_office.channels_by_name[listener.channel] = this_channel;
30
31
  } else {
31
- var this_channel = this.channels_by_name[listener.channel];
32
+ var this_channel = this_foreign_office.channels_by_name[listener.channel];
32
33
  }
33
34
  this_channel.addListener(listener);
34
35
  },
35
36
  channelNames: function(){
36
37
  return $.map(this.channels,function(channel){return channel.channel_name});
38
+ },
39
+ connect: function(){
40
+ this.connection_status = 'connected';
41
+ },
42
+ disconnection: function(){
43
+ if('connected' == this.connection_status){
44
+ this.connection_status = 'disconnected'
45
+ alert('We lost the connection to the server. No refresh data will be available. Thanks, -the Foreign Office.')
46
+ }
47
+ },
48
+ reconnection: function(){
49
+ if('disconnected' == this.connection_status){
50
+ this.connection_status = 'connected'
51
+ alert("We're connected to the server again. Refresh data will now be available. Thanks, -the Foreign Office.")
52
+ }
37
53
  }
38
54
  });
39
55
 
@@ -12,7 +12,11 @@ var PubnubBus = Class.extend({
12
12
  debug_logger.log(subscription)
13
13
  this.pubnub.subscribe({
14
14
  channel : subscription.channel,
15
- message : function(m){subscription.callback(m)}
15
+ restore : true,
16
+ disconnect : function(){foreign_office.disconnection(); debug_logger.log('Lost connection to: '); debug_logger.log(subscription.channel)},
17
+ reconnect : function(){foreign_office.reconnection(); debug_logger.log('Reestablished connection to: '); debug_logger.log(subscription.channel)},
18
+ connect : function(){foreign_office.connect(); debug_logger.log("Connected to: "); debug_logger.log(subscription.channel)},
19
+ message : function(m,env,channel){subscription.callback(m)}
16
20
  });
17
21
 
18
22
  }
@@ -1,3 +1,3 @@
1
1
  module ForeignOffice
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
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.7.0
4
+ version: 0.7.1
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: 2015-04-13 00:00:00.000000000 Z
12
+ date: 2015-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails