This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-18
Channels
- # announcements (2)
- # babashka (35)
- # beginners (59)
- # calva (17)
- # cider (3)
- # clerk (7)
- # clj-kondo (21)
- # cljfx (9)
- # cljs-dev (76)
- # clojure (98)
- # clojure-austin (3)
- # clojure-brasil (1)
- # clojure-europe (11)
- # clojure-gamedev (4)
- # clojurescript (14)
- # consulting (7)
- # cursive (6)
- # datascript (4)
- # datomic (12)
- # emacs (18)
- # events (2)
- # graalvm (9)
- # humbleui (3)
- # hyperfiddle (18)
- # jobs (4)
- # missionary (12)
- # nextjournal (2)
- # nrepl (7)
- # off-topic (31)
- # practicalli (2)
- # rdf (6)
- # releases (2)
- # scittle (10)
- # xtdb (9)
What is the most efficient way to pass data from html to scittle cljs? I could read some json from a string. Can I pass EDN data as a string?
Sorry for late response..
On my stack I have a Handlebars.js HTML templating language with some data-store access patterns built into syntax. I can access the data in the Handlebars code and render it in HTML in the same .html template file. What if I want to use that (indirectly sourced) data in Scittle? Currently I am rendering a string in a html data attribute, then in Scittle cljs, accessing that dom node, reading the data value, and parsing the string into a cljs data structure…
Is there a more direct way? If I “print” an EDN literal into this html, can Scittle cljs “read” that as cljs data directly somehow? I think technically it would still be a string coming into cljs runtime. Is there a read-edn fn?
I could render an additional Scittle <script>
tag in the html, with a def’d EDN value, and Scittle could likely just see that as named data. But then the placing of the script tag might be complicated…?
I would probably be better off trying to get the json data more directly (from fetch
or something), but I was curious what was supported?
perhaps if you have github project + index.html page I could look at locally, I could say more
Thanks for the feedback. read-string
sounds most appropriate for this case. I will try that. I’ll make a simplified repo later for public consideration…