queue up messages to send until a socket is available, for browsers
This commit is contained in:
parent
75f6ebdcf5
commit
120010c2b6
@ -7,11 +7,19 @@ Flowerbox =
|
|||||||
ping: ->
|
ping: ->
|
||||||
Flowerbox.contact('ping')
|
Flowerbox.contact('ping')
|
||||||
|
|
||||||
|
messageQueue: []
|
||||||
|
|
||||||
contact: (url, data...) ->
|
contact: (url, data...) ->
|
||||||
Flowerbox.started = true
|
Flowerbox.started = true
|
||||||
|
|
||||||
if !Flowerbox.debug
|
if !Flowerbox.debug
|
||||||
Flowerbox.socket.send(JSON.stringify([ url, data ]))
|
message = [ url, data ]
|
||||||
|
Flowerbox.messageQueue.push(message)
|
||||||
|
|
||||||
|
if Flowerbox.socket
|
||||||
|
while Flowerbox.messageQueue.length > 0
|
||||||
|
message = Flowerbox.messageQueue.shift()
|
||||||
|
Flowerbox.socket.send(JSON.stringify(message))
|
||||||
|
|
||||||
Flowerbox.done = true if url == 'results'
|
Flowerbox.done = true if url == 'results'
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ module Flowerbox
|
|||||||
|
|
||||||
def _call(env)
|
def _call(env)
|
||||||
if sprockets_file = env['PATH_INFO'][%r{/__F__(.*)$}, 1]
|
if sprockets_file = env['PATH_INFO'][%r{/__F__(.*)$}, 1]
|
||||||
sprockets.call(env.merge('PATH_INFO' => sprockets_file))
|
sprockets.call(env.merge('QUERY_STRING' => 'body=1', 'PATH_INFO' => sprockets_file))
|
||||||
else
|
else
|
||||||
[ 200, { 'Content-type' => 'text/html' }, [ runner.template ] ]
|
[ 200, { 'Content-type' => 'text/html' }, [ runner.template ] ]
|
||||||
end
|
end
|
||||||
|
@ -6,7 +6,7 @@ module Flowerbox::Run
|
|||||||
env = Flowerbox.runner_environment.first
|
env = Flowerbox.runner_environment.first
|
||||||
env.setup(sprockets, spec_files, options)
|
env.setup(sprockets, spec_files, options)
|
||||||
|
|
||||||
Flowerbox.reporters.replace([])
|
Flowerbox.reporters.clear!
|
||||||
|
|
||||||
puts "Flowerbox debug server running test prepared for #{env.console_name} on #{env.server.address}"
|
puts "Flowerbox debug server running test prepared for #{env.console_name} on #{env.server.address}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user