|
38 | 38 |
|
39 | 39 | (defn flush-print-queue! [conn] |
40 | 40 | (doseq [str print-queue] |
41 | | - (net/transmit conn :print str)) |
| 41 | + (net/transmit conn :print |
| 42 | + (json/serialize |
| 43 | + #js {"repl" *repl* |
| 44 | + "str" str}))) |
42 | 45 | (garray/clear print-queue)) |
43 | 46 |
|
44 | 47 | (defn repl-print [data] |
|
137 | 140 |
|
138 | 141 | (net/register-service repl-connection |
139 | 142 | :send-result |
140 | | - (fn [{:keys [repl result]}] |
141 | | - (send-result connection url |
142 | | - (wrap-message repl :result result)))) |
| 143 | + (fn [json] |
| 144 | + (let [obj (json/parse json) |
| 145 | + repl (gobj/get obj "repl") |
| 146 | + result (gobj/get obj "result")] |
| 147 | + (send-result connection url |
| 148 | + (wrap-message repl :result result))))) |
143 | 149 |
|
144 | 150 | (net/register-service repl-connection |
145 | 151 | :print |
146 | | - (fn [data] |
147 | | - (send-print url (wrap-message nil :print data))))) |
| 152 | + (fn [json] |
| 153 | + (let [obj (json/parse json) |
| 154 | + repl (gobj/get obj "repl") |
| 155 | + str (gobj/get obj "str")] |
| 156 | + (send-print url (wrap-message repl :print str)))))) |
148 | 157 | (js/alert "No 'xpc' param provided to child iframe."))) |
149 | 158 |
|
150 | 159 | (def load-queue nil) |
|
233 | 242 | (net/register-service repl-connection |
234 | 243 | :evaluate-javascript |
235 | 244 | (fn [json] |
236 | | - (let [obj (json/parse json)] |
| 245 | + (let [obj (json/parse json) |
| 246 | + repl (gobj/get obj "repl") |
| 247 | + form (gobj/get obj "form")] |
237 | 248 | (net/transmit |
238 | 249 | repl-connection |
239 | 250 | :send-result |
240 | | - {:repl (gobj/get obj "repl") |
241 | | - :result (evaluate-javascript repl-connection |
242 | | - (gobj/get obj "form"))})))) |
| 251 | + (json/serialize |
| 252 | + #js {"repl" repl |
| 253 | + "result" |
| 254 | + (binding [*repl* repl] |
| 255 | + (evaluate-javascript repl-connection form))}))))) |
243 | 256 | (net/connect repl-connection |
244 | 257 | (constantly nil) |
245 | 258 | (fn [iframe] |
|
0 commit comments