Skip to content

Commit 86f8255

Browse files
committed
CLJS-1384: cljs.js/eval-str doc that :ns returned upon success
1 parent 4fd1e20 commit 86f8255

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/main/cljs/cljs/js.cljs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,9 @@
728728
729729
cb (function)
730730
callback, will be invoked with a map. If succesful the map will contain
731-
a :value key with the result of evaluation. If unsuccessful will contain
732-
a :error key with an ex-info instance describing the cause of failure."
731+
a :value key with the result of evaluation and :ns the current namespace.
732+
If unsuccessful will contain a :error key with an ex-info instance describing
733+
the cause of failure."
733734
([state source cb]
734735
(eval-str state source nil cb))
735736
([state source name cb]
@@ -860,6 +861,20 @@
860861
(println (.. error -cause -stack)))
861862
(println "Result:" res))))
862863

864+
(cljs/compile-str st
865+
"(ns foo.bar (:require-macros [bootstrap-test.macros :refer [foo]]))\n(foo 4 4)"
866+
'foo.bar
867+
{:verbose true
868+
:source-map true
869+
:eval node-eval
870+
:load node-load}
871+
(fn [{:keys [error] :as res}]
872+
(if error
873+
(do
874+
(println "Error:" error)
875+
(println (.. error -cause -stack)))
876+
(println "Result:" res))))
877+
863878
(cljs/eval-str st
864879
"(ns foo.bar)\n(first [1 2 3])"
865880
'foo.bar

0 commit comments

Comments
 (0)