foreign_office 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffa19274a9c4f956525240daf76d9fff4b59baa5
|
4
|
+
data.tar.gz: ca6e62d10fc74ae7bcea1274627e79ae87af8e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
29
|
-
|
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 =
|
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
|
-
|
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
|
}
|
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.
|
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-
|
12
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|