sinatra-multi-screen 0.0.4 → 0.0.5
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/History.txt +4 -0
- data/README.md +5 -1
- data/lib/js/multiscreen.js +9 -8
- data/lib/sinatra-multi-screen/version.rb +1 -1
- data/sample/Gemfile +1 -0
- data/sample/Gemfile.lock +2 -1
- data/sample/public/js/remote.js +3 -3
- data/sample/public/js/tv.js +1 -3
- data/sample/views/remote.haml +1 -0
- data/sample/views/tv.haml +1 -0
- data/sinatra-multi-screen.gemspec +1 -0
- metadata +18 -2
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -44,8 +44,12 @@ var screen = new MultiScreen(io, {type: "remote", channel: "1"});
|
|
44
44
|
var tv = screen.tv;
|
45
45
|
|
46
46
|
io.on("connect", function(session){
|
47
|
-
tv.$("#btn").click(); // dispatch
|
47
|
+
tv.$("#btn").click(); // dispatch CLICK event on TV Side
|
48
48
|
};
|
49
|
+
|
50
|
+
tv.on("ui_event", function(data){ // UI Event echo back from TV
|
51
|
+
alert(data.event+' was dispatched on TV-side '+data.selector);
|
52
|
+
});
|
49
53
|
```
|
50
54
|
|
51
55
|
TV Side
|
data/lib/js/multiscreen.js
CHANGED
@@ -31,31 +31,31 @@ var MultiScreen = function(cometio, options){
|
|
31
31
|
})
|
32
32
|
|
33
33
|
if(options.type == "remote"){
|
34
|
-
this.tv.
|
34
|
+
this.tv.ui_event = function(selector, event_name, arg){
|
35
35
|
self.tv.push("ui_event", {selector: selector, event: event_name, arg: arg});
|
36
36
|
};
|
37
37
|
this.tv.$ = function(selector){
|
38
38
|
return {
|
39
39
|
click: function(){
|
40
|
-
self.tv.
|
40
|
+
self.tv.ui_event(selector, "click");
|
41
41
|
},
|
42
42
|
dblclick: function(){
|
43
|
-
self.tv.
|
43
|
+
self.tv.ui_event(selector, "dblclick");
|
44
44
|
},
|
45
45
|
mouseover: function(){
|
46
|
-
self.tv.
|
46
|
+
self.tv.ui_event(selector, "mouseover");
|
47
47
|
},
|
48
48
|
mousedown: function(){
|
49
|
-
self.tv.
|
49
|
+
self.tv.ui_event(selector, "mousedown");
|
50
50
|
},
|
51
51
|
mouseup: function(){
|
52
|
-
self.tv.
|
52
|
+
self.tv.ui_event(selector, "mouseup");
|
53
53
|
},
|
54
54
|
val: function(value){
|
55
|
-
self.tv.
|
55
|
+
self.tv.ui_event(selector, "val", value);
|
56
56
|
},
|
57
57
|
change: function(){
|
58
|
-
self.tv.
|
58
|
+
self.tv.ui_event(selector, "change");
|
59
59
|
}
|
60
60
|
};
|
61
61
|
};
|
@@ -70,6 +70,7 @@ var MultiScreen = function(cometio, options){
|
|
70
70
|
}else{
|
71
71
|
$(data.selector)[data.event](data.arg);
|
72
72
|
}
|
73
|
+
self.remote.push("ui_event", data);
|
73
74
|
});
|
74
75
|
}
|
75
76
|
};
|
data/sample/Gemfile
CHANGED
data/sample/Gemfile.lock
CHANGED
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
rack
|
16
16
|
rack-test (0.6.2)
|
17
17
|
rack (>= 1.0)
|
18
|
-
sass (3.2.
|
18
|
+
sass (3.2.6)
|
19
19
|
sinatra (1.3.4)
|
20
20
|
rack (~> 1.4)
|
21
21
|
rack-protection (~> 1.3)
|
@@ -45,6 +45,7 @@ PLATFORMS
|
|
45
45
|
ruby
|
46
46
|
|
47
47
|
DEPENDENCIES
|
48
|
+
event_emitter
|
48
49
|
foreman
|
49
50
|
haml
|
50
51
|
json
|
data/sample/public/js/remote.js
CHANGED
@@ -7,9 +7,9 @@ io.on("connect", function(session){
|
|
7
7
|
console.log("connect!! "+session);
|
8
8
|
});
|
9
9
|
|
10
|
-
// from TV
|
11
|
-
tv.on("
|
12
|
-
|
10
|
+
// UI Event echo back from TV
|
11
|
+
tv.on("ui_event", function(data){
|
12
|
+
$("#message").text(data.event+' was dispatched on TV-side '+data.selector);
|
13
13
|
});
|
14
14
|
|
15
15
|
$(function(){
|
data/sample/public/js/tv.js
CHANGED
@@ -9,18 +9,16 @@ io.on("connect", function(session){
|
|
9
9
|
|
10
10
|
// catch UI Event from Remote
|
11
11
|
remote.on("ui_event", function(data){
|
12
|
-
|
12
|
+
$("#message").text(JSON.stringify(data));
|
13
13
|
});
|
14
14
|
|
15
15
|
$(function(){
|
16
16
|
$(".btn").click(function(e){
|
17
17
|
alert(e.currentTarget.innerText);
|
18
|
-
remote.push("message", "click button #"+e.currentTarget.id); // push to Remote
|
19
18
|
});
|
20
19
|
|
21
20
|
$(".btn").mouseover(function(e){
|
22
21
|
var color = e.currentTarget.attributes['x-color'].value;
|
23
22
|
$("body").css("background-color", color);
|
24
|
-
remote.push("message", "mouse over "+color); // push to Remote
|
25
23
|
});
|
26
24
|
});
|
data/sample/views/remote.haml
CHANGED
data/sample/views/tv.haml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-multi-screen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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-02-
|
12
|
+
date: 2013-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -49,6 +49,22 @@ dependencies:
|
|
49
49
|
- - <
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: 0.2.0
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: event_emitter
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
52
68
|
description: Sinatra Plugin for Multi-Screen Application.
|
53
69
|
email:
|
54
70
|
- hashimoto@shokai.org
|