Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Partially working with IE #310

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashing.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = 'dashing'
s.version = '1.3.2'
s.version = '1.3.x'
s.date = '2013-11-21'
s.executables << 'dashing'

Expand Down
3 changes: 2 additions & 1 deletion javascripts/dashing.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ Dashing.debugMode = false

source = new EventSource('events')
source.addEventListener 'open', (e) ->
console.log("Connection opened", e)
if Dashing.debugMode
console.log("Connection opened", e)

source.addEventListener 'error', (e)->
console.log("Connection error", e)
Expand Down
11 changes: 11 additions & 0 deletions lib/dashing/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,19 @@ def protected!
get '/events', provides: 'text/event-stream' do
protected!
response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx
response.headers['Access-Control-Allow-Origin'] = '*' # For Yaffle eventsource polyfill
response.headers['Cache-Control'] = 'no-cache' # For Yaffle eventsource polyfill

stream :keep_open do |out|
settings.connections << out

# For Yaffle eventsource polyfill
#Add 2k padding for IE
str = ":".ljust(2049) << "\n"
#add retry key
str << "retry: 2000\n"
out << str

out << latest_events
out.callback { settings.connections.delete(out) }
end
Expand Down
6 changes: 5 additions & 1 deletion templates/project/assets/javascripts/application.coffee
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# make sure Yaffle's eventsource goes in first
#= require eventsource.js


# dashing.js is located in the dashing framework
# It includes jquery & batman for you.
#= require dashing.js

#= require_directory .
#= require_tree ../../widgets

console.log("Yeah! The dashboard has started!")
# console.log("Yeah! The dashboard has started!")

Dashing.on 'ready', ->
Dashing.widget_margins ||= [5, 5]
Expand Down
Loading