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 +4 -0
- data/lib/js/event_emitter.js +11 -4
- data/lib/sinatra-cometio/version.rb +1 -1
- data/lib/sinatra/cometio/client.rb +1 -1
- data/sample/Gemfile.lock +2 -2
- data/sample/public/js/index.js +4 -0
- metadata +2 -2
data/History.txt
CHANGED
data/lib/js/event_emitter.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// event_emitter.js v0.0.
|
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
|
-
|
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
|
66
|
+
if(typeof module !== 'undefined' && typeof module.exports !== 'undefined'){
|
67
|
+
module.exports = EventEmitter;
|
61
68
|
}
|
data/sample/Gemfile.lock
CHANGED
data/sample/public/js/index.js
CHANGED
@@ -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.
|
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-
|
12
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|