File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change 126
126
127
127
#_(pr-str (read-msg " #viewer-eval (resolve 'clojure.core/inc)" ))
128
128
129
+ (defn update-window! [id state]
130
+ (swap! !windows assoc id state)
131
+ (broadcast! {:type :set-window-state! :id id :state state}))
132
+
133
+ (defn update-windows! []
134
+ (doseq [[id state] @!windows]
135
+ (update-window! id state)))
136
+
137
+ (defn close-window! [id]
138
+ (swap! !windows dissoc id)
139
+ (broadcast! {:type :close-window! :id id}))
140
+
129
141
(def ws-handlers
130
- {:on-open (fn [ch] (swap! !clients conj ch))
142
+ {:on-open (fn [ch]
143
+ (swap! !clients conj ch)
144
+ (update-windows! ))
131
145
:on-close (fn [ch _reason] (swap! !clients disj ch))
132
146
:on-receive (fn [sender-ch edn-string]
133
147
(binding [*ns* (or (:ns @!doc)
193
207
194
208
#_(update-doc! (help-doc ))
195
209
196
- (defn update-window! [id state]
197
- (swap! !windows assoc id state)
198
- (broadcast! {:type :set-window-state! :id id :state state}))
199
-
200
- (defn close-window! [id]
201
- (swap! !windows dissoc id)
202
- (broadcast! {:type :close-window! :id id}))
203
-
204
-
205
210
(defn broadcast-status! [status]
206
211
; ; avoid editscript diff but use manual patch to just replace `:status` in doc
207
212
(broadcast! {:type :patch-state! :patch [[[:status ] :r status]]}))
You can’t perform that action at this time.
0 commit comments