Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit f49cf54

Browse files
committed
Merge pull request #31 from LightTable/add-refresh-connection
Add refresh connection command to make figwheel-like workflows possible
2 parents 9612814 + 5018c84 commit f49cf54

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ There are 3 ways to eval ClojureScript, 2 of which use your ClojureScript javasc
2929
For ClojureScript projects:
3030

3131
Your project is connected to a browser. Recompile cljs outside of LT with project's cljs compile tool e.g. `lein cljsbuild auto`.
32-
Most changes can be evaled. However, if adding project dependencies or requires to ns, refresh the browser page after cljs has been compiled.
32+
Most changes can be evaled. However, if adding project dependencies or requires to ns, use the `:client.refresh-connection` command
33+
to refresh the browser page. To automate this on-save, add this to `user.behaviors`:
34+
35+
```clojurescript
36+
:editor.clojurescript [(:lt.objs.editor.file/on-save :client.refresh-connection)]
37+
```
3338

3439
For LightTable plugins:
3540

src/lt/plugins/clojure.cljs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[lt.objs.deploy :as deploy]
1111
[lt.objs.console :as console]
1212
[lt.objs.editor :as ed]
13+
[lt.objs.editor.pool :as pool]
1314
[lt.objs.connector :as connector]
1415
[lt.objs.popup :as popup]
1516
[lt.objs.platform :as platform]
@@ -868,3 +869,9 @@
868869
:tags #{:clojure.lang})
869870

870871
(def clj-lang (object/create ::langs.clj))
872+
873+
(cmd/command {:command :client.refresh-connection
874+
:desc "Client: Refresh client connection"
875+
:exec (fn []
876+
(when-let [client (-> (pool/last-active) deref :client :exec)]
877+
(object/raise client :client.refresh!)))})

0 commit comments

Comments
 (0)