diff --git a/docs/dominoes-live.md b/docs/dominoes-live.md index 123f10032..b9703eb49 100644 --- a/docs/dominoes-live.md +++ b/docs/dominoes-live.md @@ -37,9 +37,10 @@ We'll look at all 70 lines. Within our single namespace (of 70 lines), we'll need access to both `reagent` and `re-frame`. So, at the top we need this:
-(require '[reagent.core :as reagent] - '[reagent.dom :as rdom] - '[re-frame.core :as rf]) +(ns re-frame.simple + (:require [reagent.core :as reagent] + [reagent.dom :as rdom] + [re-frame.core :as rf]))
!!! Note "Live Code Fragment" diff --git a/docs/reagent.md b/docs/reagent.md index 8aa2df8ac..21699c829 100644 --- a/docs/reagent.md +++ b/docs/reagent.md @@ -4,10 +4,11 @@ Clojurescript is ergonomic, stable, functional language Look at the front page of https://www.learnreframe.com/ -
-(require '[reagent.dom :as rdom] - '[re-frame.core :as rf] - '[clojure.string :as str]) +
+(ns simple.core + (:require [reagent.dom :as rdom] + [re-frame.core :as rf] + [clojure.string :as str])))
diff --git a/docs/src/re_frame/docs.cljs b/docs/src/re_frame/docs.cljs index 007982b70..41085b821 100644 --- a/docs/src/re_frame/docs.cljs +++ b/docs/src/re_frame/docs.cljs @@ -35,9 +35,13 @@ :ns-aliases {'clojure.pprint 'cljs.pprint}})] (ctx-store/reset-ctx! ctx)) -(defn eval-str [source-str] +(def last-ns (volatile! nil)) + +(defn eval-str [source-str & [opts]] (try - (let [v (sci/eval-string* (ctx-store/get-ctx) source-str)] + (let [{:keys [val ns]} (sci/eval-string+ (ctx-store/get-ctx) source-str {:ns @last-ns}) + v val] + (vreset! last-ns ns) (if (instance? js/Promise v) (-> v (.then diff --git a/project.clj b/project.clj index ecb9aaa81..7ff41b4ef 100644 --- a/project.clj +++ b/project.clj @@ -26,7 +26,7 @@ :plugins [[com.github.liquidz/antq "RELEASE"] [lein-shell "0.5.0"]] :antq {}} - :docs {:dependencies [[org.babashka/sci "0.7.39"] + :docs {:dependencies [[org.babashka/sci "0.8.40"] [funcool/promesa "10.0.575"]]}} :clean-targets [:target-path