This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-14
Channels
- # announcements (1)
- # beginners (85)
- # calva (23)
- # cider (3)
- # clj-kondo (33)
- # cljs-dev (12)
- # clojure (79)
- # clojure-dev (5)
- # clojure-europe (1)
- # clojure-nl (3)
- # clojure-uk (3)
- # clojurescript (5)
- # clojutre (2)
- # data-science (30)
- # datomic (3)
- # duct (7)
- # fulcro (8)
- # garden (18)
- # jackdaw (2)
- # leiningen (1)
- # off-topic (3)
- # pathom (4)
- # qa (24)
- # re-frame (13)
- # reagent (3)
- # shadow-cljs (58)
- # testing (1)
hi guys i am using google maps in my cljs app
and i am creating info windows for my markers
https://developers.google.com/maps/documentation/javascript/infowindows
in this example they are passing content as string
which i kinda don't like
so i wanted to create hiccup->html
fn but i suppose there are libraries for that
the only one i found was https://github.com/davidsantiago/hickory
but i am unsure if approach is good.
Are there any better solutions that i am not aware of?
I want to do an "autodetection" mechanism in my library to load implementation only if a requisite namespace exists on the classpath, but I hit this in my CLJS tests: Calls to 'require' must appear at the top-level
(defn- datomic-exists? [] (boolean (find-ns 'datomic.api)))
(defn- datascript-exists? [] (boolean (find-ns 'datascript.db)))
(defn- require-implementations
[]
(when (datomic-exists?)
(require '[northstar.model.database.datomic]))
(when (datascript-exists?)
(require '[northstar.model.database.datascript])))
Is there a way to do this sort of auto-detection in CLJS?
As a workaround, I believe I could:
A) use CLJC macros & make CLJS library consumers manually require the implementation ns northstar.model.database.datascript
B) just assume CLJS clients have already included DataScript & hardwire the require in (this assumption holds true for all current consumers)Others will be able to answer more authoritative (and I am curious to hear an answer from someone with more in-depth knowledge, too, to confirm), but CLJS is a bit less dynamic than CLJ in this way.