ClojureScript

cljs.main: Graceful shutdown for browser REPL if timers in flight

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

deps.edn:

{:deps {org.clojure/clojurescript
        {:git/url "https://github.com/clojure/clojurescript"
         :sha "435af1a9ee69e225676fe743556d60efff5bde37"}}}

Node and Nashorn have the desired shutdown-blocking property, but not Browser:

$ clj -m cljs.main -re nashorn -e '(js/setTimeout #(prn :hi) 1000)' -e ':goodbye'
#object[Object]
:goodbye
:hi
$ clj -m cljs.main -re node -e '(js/setTimeout #(prn :hi) 1000)' -e ':goodbye'
#object[Timeout [object Object]]
:goodbye
:hi
$ clj -m cljs.main -re browser -e '(js/setTimeout #(prn :hi) 1000)' -e ':goodbye'
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
13
:goodbye

This would be useful for running asynchronous tests, like those in core.async.

Activity

Hide
David Nolen added a comment -

I don't know that there's anyway to make this work? We don't control the browser process the way the other REPLs control the JS runtime.

Show
David Nolen added a comment - I don't know that there's anyway to make this work? We don't control the browser process the way the other REPLs control the JS runtime.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: