goat 0.3.8 → 0.3.9
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.
- data/goat.gemspec +1 -1
- data/lib/goat/goat.js +20 -2
- metadata +4 -4
data/goat.gemspec
CHANGED
data/lib/goat/goat.js
CHANGED
@@ -75,7 +75,8 @@ $(document).ready(function() {
|
|
75
75
|
var GoatRT = {
|
76
76
|
version: 0,
|
77
77
|
pendingTxns: {},
|
78
|
-
ops: {}
|
78
|
+
ops: {},
|
79
|
+
consecutiveFailures: 0
|
79
80
|
};
|
80
81
|
|
81
82
|
(function(rt) {
|
@@ -153,12 +154,18 @@ var GoatRT = {
|
|
153
154
|
|
154
155
|
if(m.version == rt.version + 1) {
|
155
156
|
$(updates).each(function(_,u) {
|
157
|
+
rt.consecutiveFailures = 0;
|
156
158
|
applyUpdate(u);
|
157
159
|
});
|
158
160
|
rt.version++;
|
159
161
|
} else if(m.version <= rt.version) {
|
162
|
+
rt.consecutiveFailures = 0;
|
160
163
|
// fine, we already have this
|
161
164
|
} else {
|
165
|
+
rt.consecutiveFailures++;
|
166
|
+
if(rt.consecutiveFailures > 5) {
|
167
|
+
Goat.setPageDead();
|
168
|
+
}
|
162
169
|
updateFailed("Tried to apply update " + version + ", but I'm only at version " + rt.version);
|
163
170
|
}
|
164
171
|
}
|
@@ -275,9 +282,16 @@ var GoatRPC = Class.extend({
|
|
275
282
|
return this;
|
276
283
|
},
|
277
284
|
|
285
|
+
pageDeadFailure: function() {
|
286
|
+
alert("Sorry, you'll need to reload the page before this will work.");
|
287
|
+
},
|
288
|
+
|
278
289
|
send: function() {
|
279
290
|
var data = this.data;
|
280
291
|
|
292
|
+
if(Goat.pageDead)
|
293
|
+
return this.pageDeadFailure();
|
294
|
+
|
281
295
|
data['cls'] = this.component.cls;
|
282
296
|
data['id'] = this.component.id;
|
283
297
|
data['rpc'] = this.name;
|
@@ -346,6 +360,10 @@ $.extend(Goat, {
|
|
346
360
|
alert(alert_msg);
|
347
361
|
},
|
348
362
|
|
363
|
+
setPageDead: function() {
|
364
|
+
this.pageDead = true;
|
365
|
+
},
|
366
|
+
|
349
367
|
messageReceived: function(m) {
|
350
368
|
console.log(m);
|
351
369
|
|
@@ -358,7 +376,7 @@ $.extend(Goat, {
|
|
358
376
|
window.location = m['location'];
|
359
377
|
} else if(t == 'page_expired') {
|
360
378
|
alert("Due to inactivity, you'll need to refresh this page.");
|
361
|
-
Goat.
|
379
|
+
Goat.setPageDead();
|
362
380
|
} else if(t == 'txn_complete') {
|
363
381
|
GoatRT.txnCompleteMsg(m);
|
364
382
|
} else if(t == 'alert') {
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 9
|
10
|
+
version: 0.3.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Collison
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-20 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|