sinatra-cometio 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.8 2013-3-6
2
+
3
+ * update event_emitter.js
4
+
1
5
  === 0.1.7 2013-3-3
2
6
 
3
7
  * bugfix CometIO Ruby client
@@ -1,4 +1,4 @@
1
- // event_emitter.js v0.0.3
1
+ // event_emitter.js v0.0.5
2
2
  // https://github.com/shokai/EventEmitter.js
3
3
  // (c) 2013 Sho Hashimoto <hashimoto@shokai.org>
4
4
  // The MIT License
@@ -35,7 +35,14 @@ var EventEmitter = function(){
35
35
  this.emit = function(type, data){
36
36
  for(var i = 0; i < self.__events.length; i++){
37
37
  var e = self.__events[i];
38
- if(e.type == type) e.listener(data);
38
+ switch(e.type){
39
+ case type:
40
+ e.listener(data);
41
+ break
42
+ case '*':
43
+ e.listener(type, data);
44
+ break
45
+ }
39
46
  if(e.once) self.removeListener(e.id);
40
47
  }
41
48
  };
@@ -56,6 +63,6 @@ var EventEmitter = function(){
56
63
 
57
64
  };
58
65
 
59
- if(typeof exports !== 'undefined'){
60
- exports.EventEmitter = EventEmitter;
66
+ if(typeof module !== 'undefined' && typeof module.exports !== 'undefined'){
67
+ module.exports = EventEmitter;
61
68
  }
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module CometIO
3
- VERSION = '0.1.7'
3
+ VERSION = '0.1.8'
4
4
  end
5
5
  end
@@ -61,7 +61,7 @@ class CometIO
61
61
  rescue Timeout::Error, JSON::ParserError
62
62
  next
63
63
  rescue StandardError
64
- self.emit :error, "CometIO get error 2"
64
+ self.emit :error, "CometIO get error"
65
65
  sleep 10
66
66
  next
67
67
  end
data/sample/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- backports (3.0.3)
4
+ backports (3.1.0)
5
5
  daemons (1.1.9)
6
- event_emitter (0.2.2)
6
+ event_emitter (0.2.3)
7
7
  eventmachine (1.0.1)
8
8
  foreman (0.61.0)
9
9
  thor (>= 0.13.6)
@@ -5,6 +5,10 @@ io.on("chat", function(data){
5
5
  $("#chat #timeline").prepend(m);
6
6
  });
7
7
 
8
+ io.on("*", function(event, data){ // catch all events
9
+ console.log(event + " - " + JSON.stringify(data));
10
+ });
11
+
8
12
  io.on("connect", function(session){
9
13
  console.log("connect!! "+session);
10
14
  $("#chat #btn_send").click(post);
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.1.7
4
+ version: 0.1.8
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-05 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack