sinatra-cometio 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.3.6 2013-03-19
2
+
3
+ * update event_emitter.js v0.0.7
4
+ * bugfix validation in client side ajax-get
5
+
1
6
  === 0.3.5 2013-03-18
2
7
 
3
8
  * check javascript error on ajax get
data/lib/js/cometio.js CHANGED
@@ -31,7 +31,7 @@ var CometIO = function(){
31
31
  self.emit("connect", self.session);
32
32
  });
33
33
  running = true;
34
- self.get();
34
+ get();
35
35
  return self;
36
36
  };
37
37
 
@@ -40,23 +40,24 @@ var CometIO = function(){
40
40
  self.removeListener("__session_id");
41
41
  };
42
42
 
43
- this.get = function(){
43
+ var get = function(){
44
44
  if(!running) return;
45
45
  $.ajax(
46
46
  {
47
47
  url : self.url,
48
48
  data : {session : self.session},
49
49
  success : function(data_arr){
50
- if(typeof data_arr === "undefined" || !data_arr.length) return;
51
- for(var i = 0; i < data_arr.length; i++){
52
- var data = data_arr[i];
53
- if(data) self.emit(data.type, data.data);
50
+ if(data_arr !== null || typeof data_arr !== "undefined" || !!data_arr.length){
51
+ for(var i = 0; i < data_arr.length; i++){
52
+ var data = data_arr[i];
53
+ if(data) self.emit(data.type, data.data);
54
+ }
54
55
  }
55
- self.get();
56
+ get();
56
57
  },
57
58
  error : function(req, stat, e){
58
59
  self.emit("error", "CometIO get error");
59
- setTimeout(self.get, 10000);
60
+ setTimeout(get, 10000);
60
61
  },
61
62
  complete : function(e){
62
63
  },
@@ -1,5 +1,5 @@
1
- // event_emitter.js v0.0.5
2
- // https://github.com/shokai/EventEmitter.js
1
+ // event_emitter.js v0.0.7
2
+ // https://github.com/shokai/event_emitter.js
3
3
  // (c) 2013 Sho Hashimoto <hashimoto@shokai.org>
4
4
  // The MIT License
5
5
  var EventEmitter = function(){
@@ -7,7 +7,7 @@ var EventEmitter = function(){
7
7
  this.apply = function(target, prefix){
8
8
  if(!prefix) prefix = "";
9
9
  for(var func in self){
10
- if(self.hasOwnProperty(func)){
10
+ if(self.hasOwnProperty(func) && func !== "apply"){
11
11
  target[prefix+func] = this[func];
12
12
  }
13
13
  }
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module CometIO
3
- VERSION = '0.3.5'
3
+ VERSION = '0.3.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-cometio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-17 00:00:00.000000000 Z
12
+ date: 2013-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack