File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 1616 :author " Bobby Calderwood and Alex Redington" }
1717 clojure.browser.repl
1818 (:require [goog.dom :as gdom]
19+ [goog.labs.userAgent.browser :as gbrowser]
1920 [clojure.browser.net :as net]
2021 [clojure.browser.event :as event]
2122 ; ; repl-connection callback will receive goog.require('cljs.repl')
3334(defn evaluate-javascript
3435 " Process a single block of JavaScript received from the server"
3536 [conn block]
36- (let [result (try {:status :success :value (str (js* " eval(~{block})" ))}
37- (catch :default e
38- {:status :exception :value (pr-str e)
39- :stacktrace (if (.hasOwnProperty e " stack" )
40- (.-stack e)
41- " No stacktrace available." )}))]
37+ (let [result
38+ (try
39+ {:status :success
40+ :value (str (js* " eval(~{block})" ))}
41+ (catch :default e
42+ {:status :exception
43+ ; ; TODO: latest GCL interface for this is different
44+ ; ; see goog.userAgent.product
45+ :ua-product
46+ (cond
47+ (gbrowser/isSafari ) :safari
48+ (gbrowser/isChrome ) :chrome
49+ (gbrowser/isFirefox ) :firefox
50+ (gbrowser/isIE ) :ie )
51+ :value (pr-str e)
52+ :stacktrace
53+ (if (.hasOwnProperty e " stack" )
54+ (.-stack e)
55+ " No stacktrace available." )}))]
4256 (pr-str result)))
4357
4458(defn send-result [connection url data]
You can’t perform that action at this time.
0 commit comments