See https://dev.clojure.org/jira/browse/CLJS-2722
You can give eval-str a callback which is called with the result of the evaluation, see http://cljs.github.io/api/cljs.js/eval-str On Wednesday, 14 November 2018 18:38:13 UTC+1, Kashyap CK wrote: > > I was trying to dabble with eval and found the same thing - is there a > newer way to do eval in cljs? > > On Friday, March 30, 2018 at 10:30:54 PM UTC-7, Richard Davies wrote: >> >> Ok so I've deleted my project's out and .cpcache directories and my ~/.m2 >> directory just in case there was something being cached between the two >> versions and this still isn't working as expected. There's nothing in the >> release notes at https://clojurescript.org/news/2018-03-26-release about >> changes to compiler options in eval-str/eval but before I log a bug, could >> someone else who has changed to 1.10.238 try this snippet to see if it >> works? >> >> (ns my.sample >> (:require [cljs.js :as cjs])) >> >> (enable-console-print!) >> >> (println (cjs/eval-str (cjs/empty-state) "(+ 1 1)" "" {:context :expr >> :eval cjs/js-eval} identity)) >> >> In 1.9.946 it returns {:ns cljs.user, :value 2} and it's returning nil in >> 1.10.238 >> >> I'm testing in Chrome 65.0.3325.181 >> >> Thanks, >> Richard >> >> On Wednesday, 28 March 2018 01:39:45 UTC+11, Richard Davies wrote: >>> >>> Hi, >>> >>> This code >>> (cjs/eval-str (cjs/empty-state) "(+ 1 1)" "some.name" {:context :expr >>> :eval cjs/js-eval} identity) >>> >>> executes as expected under 1.9.946, but in 1.10.238 returns nil. Do I >>> need to set different compiler options now, or is this a bug? >>> >>> I have tried eval under both versions and it behaves the same way; it's >>> only eval-str that seems to show a difference between versions. >>> >>> Regards, >>> Richard >>> >> -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.