File tree Expand file tree Collapse file tree 6 files changed +494
-4
lines changed Expand file tree Collapse file tree 6 files changed +494
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Gem ::Specification . new do |s |
4
4
s . name = 'dashing'
5
- s . version = '1.3.2 '
5
+ s . version = '1.3.x '
6
6
s . date = '2013-11-21'
7
7
s . executables << 'dashing'
8
8
Original file line number Diff line number Diff line change @@ -94,7 +94,8 @@ Dashing.debugMode = false
94
94
95
95
source = new EventSource (' /events' )
96
96
source .addEventListener ' open' , (e ) ->
97
- console .log (" Connection opened" , e)
97
+ if Dashing .debugMode
98
+ console .log (" Connection opened" , e)
98
99
99
100
source .addEventListener ' error' , (e )->
100
101
console .log (" Connection error" , e)
Original file line number Diff line number Diff line change @@ -67,8 +67,19 @@ def protected!
67
67
get '/events' , provides : 'text/event-stream' do
68
68
protected!
69
69
response . headers [ 'X-Accel-Buffering' ] = 'no' # Disable buffering for nginx
70
+ response . headers [ 'Access-Control-Allow-Origin' ] = '*' # For Yaffle eventsource polyfill
71
+ response . headers [ 'Cache-Control' ] = 'no-cache' # For Yaffle eventsource polyfill
72
+
70
73
stream :keep_open do |out |
71
74
settings . connections << out
75
+
76
+ # For Yaffle eventsource polyfill
77
+ #Add 2k padding for IE
78
+ str = ":" . ljust ( 2049 ) << "\n "
79
+ #add retry key
80
+ str << "retry: 2000\n "
81
+ out << str
82
+
72
83
out << latest_events
73
84
out . callback { settings . connections . delete ( out ) }
74
85
end
Original file line number Diff line number Diff line change
1
+ # make sure Yaffle's eventsource goes in first
2
+ # = require eventsource.js
3
+
4
+
1
5
# dashing.js is located in the dashing framework
2
6
# It includes jquery & batman for you.
3
7
# = require dashing.js
4
8
5
9
# = require_directory .
6
10
# = require_tree ../../widgets
7
11
8
- console .log (" Yeah! The dashboard has started!" )
12
+ # console.log("Yeah! The dashboard has started!")
9
13
10
14
Dashing .on ' ready' , ->
11
15
Dashing .widget_margins ||= [5 , 5 ]
You can’t perform that action at this time.
0 commit comments