Open cemerick opened 10 years ago
Nitpicking (but perhaps helpful nitpicking): I don't think an expression needs to be sent to the browser for evaluation in order to see the printed message. For example:
cljs.user=> (js/setTimeout #(println "Hello, world"))
56
cljs.user=> ; user hits <RET>
Hello, world
cljs.user=>
Yup, you're right. This is being caused by some kind of buffering, either in piggieback, or in Austin's "constrained order" evaluation mechanism (which I don't fully understand, was inherited from ClojureScript's stock browser-REPL backend).
e.g. if a callback is printing to
*out*
viaprintln
,prn
, etc., that output isn't returned to the REPL until another expression is sent for evaluation. This is due to the synchronous request/response model of the communication channel…a very reasonable thing for evaluation results, but very counterproductive w.r.t. printed output.Not sure this can be readily addressed as long as we're using the
CrossPageChannel
, with agents server-side to serialize responses. SSE + regular XHR (as discussed in #47 and elsewhere) would solve this, though that implies significant re-work.