If you're reading this on github, feel free to follow along, but it'll be a lot more fun if you clone the repo and get your hands dirty!
Austin is a really just a significant refactoring of ClojureScript's standard browser-REPL, so all of its tutorials generally apply to Austin as well. However, Austin provides a workflow that I personally find much easier to use, especially if I want to have multiple browser-connected REPLs in flight at the same time.
$AUSTIN (wherever that is), do this:
cd to
$AUSTIN/browser-connected-repl-sample, and run:
$ lein do cljsbuild once, replThis will compile the dummy sample ClojureScript namespace in
$AUSTIN/src/cljs, which happens to require the
ClojureScript browser-REPL client-side namespace.cemerick.austin.bcrepl-sample), evaluate
(run). That just starts jetty on port
8080; if you open a browser to that server, you'll
see this page (which the sample re-uses as its only
content).(def repl-env (reset! cemerick.austin.repls/browser-repl-env
(cemerick.austin/repl-env)))
This also reset!'s the new REPL environment into the
browser-repl-env atom. The sample app uses
code like this:
[:script (cemerick.austin.repls/browser-connected-repl-js)]to drop a snippet of JavaScript into the page that will cause the browser-REPL to connect to whichever REPL environment is in
browser-repl-env; your app should do likewise.(cemerick.austin.repls/cljs-repl repl-env)
reset! into the
browser-repl-env atom. Once you do that, evaluate
some ClojureScript to
make sure your shiny new REPL
is working, e.g. (js/alert "Salut!")
You can reload your app's page as many times as you like; it will
re-connect on each page load to the same REPL environment. If you want
to connect to a different REPL environment, just put the
it into browser-repl-env prior to loading the page you'd
like to have connected to it. At some point, Austin may provide a
bit of ClojureScript that will allow you to choose (from within the
browser) which REPL environment to which you'd like to connect…