I have the same requirement to have a clojurescript-form in my clojure-environment that I want to evaluate in the browser…
To make the following code-snippet work, you're supposed to have a browser-repl session running, and start a new repl-session on that same JVM from where you invoke the following forms to execute either javascript-code or clojurescript-forms in the browser. --- user=> (require 'cljs.repl) nil user=> (require 'cljs.repl.browser) nil user=> (cljs.repl.browser/browser-eval "alert('No Way!')") {:status :success, :value ""} user=> (def my-repl-env {:port 9000, :optimizations :simple, :working-dir ".lein-cljsbuild-repl", :serve-static true, :static-dir ["." "out/"], :preloaded-libs []}) #'user/my-repl-env user=> (def my-env {:context :statement :locals {}}) #'user/my-env user=> (#'cljs.repl/eval-and-print my-repl-env my-env '(js/alert "Yes Way!")) nil nil user=> --- The public function "cljs.repl.browser/browser-eval" seems to allow you to send javascript code as a string to the browser to execute over the existing browser-repl connection. The private function "cljs.repl/eval-and-print" will take a clojurescript form, compile it to javascript and send it to the browser for execution. The "my-repl-env" and "my-env" values are artifacts needed that are normally only available within the context of the function. My apology for this huge&ugly hack… please see it as a proof of principle. There may be much more elegant solutions available… I've only scratch the surface of understanding how this clojurescript repl works in detail. -Enjoy, FrankS On Sep 17, 2012, at 9:03 PM, Brent Millare <brent.mill...@gmail.com> wrote: > And yes by eval I mean compile and run on the target (browser) > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en