lib/sinatra-rocketio/javascript.rb in sinatra-rocketio-0.0.1 vs lib/sinatra-rocketio/javascript.rb in sinatra-rocketio-0.0.2
- old
+ new
@@ -5,12 +5,12 @@
js_file_names = ['rocketio.js', 'cometio.js', 'websocketio.js', 'event_emitter.js']
js = ''
js_file_names.each do |i|
js += case i
when 'cometio.js'
- Sinatra::CometIO.javascript 'cometio.js'
+ options[:comet] ? Sinatra::CometIO.javascript('cometio.js') : ''
when 'websocketio.js'
- Sinatra::WebSocketIO.javascript 'websocketio.js'
+ options[:websocket] ? Sinatra::WebSocketIO.javascript('websocketio.js') : ''
else
j = ''
File.open(File.expand_path "../js/#{i}", File.dirname(__FILE__)) do |f|
j = f.read
end