Make it possible to not eval results.
	
		
			
	
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
				
					
				
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	This commit is contained in:
		
							parent
							
								
									b7463ac316
								
							
						
					
					
						commit
						af4d77d27d
					
				
							
								
								
									
										2
									
								
								deps.edn
								
								
								
								
							
							
						
						
									
										2
									
								
								deps.edn
								
								
								
								
							| 
						 | 
					@ -19,7 +19,7 @@
 | 
				
			||||||
        metosin/reitit-spec {:mvn/version "0.5.10"}
 | 
					        metosin/reitit-spec {:mvn/version "0.5.10"}
 | 
				
			||||||
        metosin/reitit-frontend {: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
 | 
					        ;; interactive code snippets
 | 
				
			||||||
        ;;viebel/klipse {:mvn/version "7.10.4"}
 | 
					        ;;viebel/klipse {:mvn/version "7.10.4"}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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.
 | 
					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 []
 | 
					(defn google-map-core-async []
 | 
				
			||||||
  (let [map-element (reagent/atom nil)
 | 
					  (let [map-element (reagent/atom nil)
 | 
				
			||||||
        ;; pulled out of the go block to satisfy the infer warnings, the go block removes hints
 | 
					        ;; 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
 | 
					#+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
** Create a map using google and shadow js-await
 | 
					** Create a map using google and shadow js-await
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#+BEGIN_SRC clojurescript :results output :tangle src/clojure_demo/core.cljs
 | 
					#+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]
 | 
					[google-map-js-await]
 | 
				
			||||||
#+END_SRC
 | 
					#+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Create a map using google and promesa
 | 
					** Create a map using google and promesa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
An example using promesa to render a google map.
 | 
					An example using promesa to render a google map.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,6 +74,7 @@
 | 
				
			||||||
(def async-ns (sci/create-ns 'cljs.core.async nil))
 | 
					(def async-ns (sci/create-ns 'cljs.core.async nil))
 | 
				
			||||||
(def async-in-ns (sci/create-ns 'cljs.core.async.interop nil))
 | 
					(def async-in-ns (sci/create-ns 'cljs.core.async.interop nil))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; https://github.com/babashka/sci.configs
 | 
				
			||||||
(def sci-ctx
 | 
					(def sci-ctx
 | 
				
			||||||
  (sci/init
 | 
					  (sci/init
 | 
				
			||||||
   {:classes {'js js/globalThis :allow :all}
 | 
					   {:classes {'js js/globalThis :allow :all}
 | 
				
			||||||
| 
						 | 
					@ -154,7 +155,8 @@
 | 
				
			||||||
        update-timeout (reagent/atom nil)
 | 
					        update-timeout (reagent/atom nil)
 | 
				
			||||||
        update-fn (.of (.-updateListener EditorView)
 | 
					        update-fn (.of (.-updateListener EditorView)
 | 
				
			||||||
                       (fn [^ViewUpdate view-update]
 | 
					                       (fn [^ViewUpdate view-update]
 | 
				
			||||||
                         (when (some #(= language %) ["clojure" "clojurescript"])
 | 
					                         (when (and (not= results "none")
 | 
				
			||||||
 | 
					                                    (some #(= language %) ["clojure" "clojurescript"]))
 | 
				
			||||||
                           (js/clearTimeout @update-timeout)
 | 
					                           (js/clearTimeout @update-timeout)
 | 
				
			||||||
                           (reset! update-timeout
 | 
					                           (reset! update-timeout
 | 
				
			||||||
                                   (js/setTimeout
 | 
					                                   (js/setTimeout
 | 
				
			||||||
| 
						 | 
					@ -477,19 +479,12 @@
 | 
				
			||||||
              result))))})
 | 
					              result))))})
 | 
				
			||||||
  (render-site))
 | 
					  (render-site))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
;; Generate the sitemap at start, routes are stored as plain data in cljc files
 | 
					;; Generate the sitemap at start, routes are stored as plain data in cljc files
 | 
				
			||||||
;; this means cljs and clj can read and manipulate them
 | 
					;; this means cljs and clj can read and manipulate them
 | 
				
			||||||
(sm/spit-pwa-sitemap
 | 
					(sm/spit-pwa-sitemap
 | 
				
			||||||
 "resources/public/sitemap.xml"
 | 
					 "resources/public/sitemap.xml"
 | 
				
			||||||
 "https://clojure-demos.digitaloctave.com")
 | 
					 "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
 | 
					;; we defonce the startup so that hot reloading does not reinitialize the state of the site
 | 
				
			||||||
(def launch (do (startup!) true))
 | 
					(def launch (do (startup!) true))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue