Make it possible to not eval results.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Oly 2023-08-15 09:55:23 +01:00
parent b7463ac316
commit af4d77d27d
3 changed files with 6 additions and 11 deletions

View File

@ -19,7 +19,7 @@
metosin/reitit-spec {:mvn/version "0.5.10"}
metosin/reitit-frontend {:mvn/version "0.5.10"}
thheller/shadow-cljs {:mvn/version "2.23.3"}
;thheller/shadow-cljs {:mvn/version "2.23.3"}
;; interactive code snippets
;;viebel/klipse {:mvn/version "7.10.4"}

View File

@ -109,7 +109,7 @@ key: \"" api-key "\", v: \"weekly\"});"))
In this example we render google maps using core async, async go blocks drop type hints so we need to pull out any hinting to functions, this is a shame as this version reduces the amount of nesting.
#+BEGIN_SRC clojurescript :results output :tangle src/clojure_demo/core.cljs
#+BEGIN_SRC clojurescript :results none :tangle src/clojure_demo/core.cljs
(defn google-map-core-async []
(let [map-element (reagent/atom nil)
;; pulled out of the go block to satisfy the infer warnings, the go block removes hints
@ -135,7 +135,6 @@ In this example we render google maps using core async, async go blocks drop typ
#+END_SRC
** Create a map using google and shadow js-await
#+BEGIN_SRC clojurescript :results output :tangle src/clojure_demo/core.cljs
@ -167,6 +166,7 @@ In this example we render google maps using core async, async go blocks drop typ
[google-map-js-await]
#+END_SRC
** Create a map using google and promesa
An example using promesa to render a google map.

View File

@ -74,6 +74,7 @@
(def async-ns (sci/create-ns 'cljs.core.async nil))
(def async-in-ns (sci/create-ns 'cljs.core.async.interop nil))
;; https://github.com/babashka/sci.configs
(def sci-ctx
(sci/init
{:classes {'js js/globalThis :allow :all}
@ -154,7 +155,8 @@
update-timeout (reagent/atom nil)
update-fn (.of (.-updateListener EditorView)
(fn [^ViewUpdate view-update]
(when (some #(= language %) ["clojure" "clojurescript"])
(when (and (not= results "none")
(some #(= language %) ["clojure" "clojurescript"]))
(js/clearTimeout @update-timeout)
(reset! update-timeout
(js/setTimeout
@ -477,19 +479,12 @@
result))))})
(render-site))
;; Generate the sitemap at start, routes are stored as plain data in cljc files
;; this means cljs and clj can read and manipulate them
(sm/spit-pwa-sitemap
"resources/public/sitemap.xml"
"https://clojure-demos.digitaloctave.com")
#_(macroexpand '(sm/spit-pwa-sitemap
"resources/public/sitemap.xml"
"https://clojure-demos.digitaloctave.com/"
routes))
;; we defonce the startup so that hot reloading does not reinitialize the state of the site
(def launch (do (startup!) true))