This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-05
Channels
- # beginners (11)
- # boot (121)
- # bristol-clojurians (3)
- # cider (5)
- # cljs-dev (45)
- # clojure (122)
- # clojure-conj (3)
- # clojure-germany (1)
- # clojure-japan (9)
- # clojure-russia (48)
- # clojurescript (129)
- # community-development (2)
- # cursive (17)
- # datomic (11)
- # editors-rus (3)
- # events (2)
- # funcool (32)
- # ldnclj (22)
- # om (110)
- # onyx (15)
- # re-frame (2)
this is not actually a big problem for Om Next, things are decoupled enough that a reconciler doesn’t really need a real root to work
@dnolen: if I am understanding you correctly (fn [state _]
_
is the react element owner. but still not sure if that is what you want
@dnolen: actually the devcard option :watch-atom false
should prevent rerenders of the function, verifying that right now
@dnolen: but I was thinking that I/we would be writing a defcard-next
to handle the history and data display bits
@dnolen: I'm anxious to help so if you have any problems or if you think making :watch-atom false
work will help. Let me know
and then would like to explore how to reuse or reproduce the state functionality you already have
@bhauman: so yeah the only thing I would want is the ability to give you a history hook
if I have my component as the first thing and try to return my atom as the second thing - that doesn’t work
@bhauman: so there’s no standard mechanism for showing different card types in one card?
I'm looking for clarity about how to replace both
in the new version of prismatic schema. (`both` is now deprecated)
I want to assert that something is BOTH a sorted-map
and that the key/value pairs of the sorted-map
are of certain types.
My previous, working schema was this (notice use of both
):
(def schema {:a (s/both
PersistentTreeMap ;; is a sorted-map (not just a map)
{TODO-ID TODO}) ;; in this map, each todo is keyed by its :id})
I'm trying to use constrained
as a replacement for both
, but I'm getting odd errors where I didn't previously:
(def schema {:a (s/constrained
PersistentTreeMap ;; is a sorted-map (not just a map)
{TODO-ID TODO}) ;; in this map, each todo is keyed by its :id})
Is there anything wrong with my use of constrained
? How should I do both
?
The offical docs: http://prismatic.github.io/schema/schema.core.html#var-both say to use conditional
with a single condition which makes no sense to me. I have two conditions.Okay, the penny has dropped. (s/both a b)
can be written as (s/condition a b)
... the a
is checked as the predicate and b
is checked as the body. Sneaky. So the final solution was:
(s/condition #(instance? PersistentTreeMap %) {TODO-ID TODO})
How would I go about requiring something to be an instance of goog.date.UtcDateTime using Prismatic Schema?
Who’s compiling to Node.js? Please chime in here if you could be affected by a change in how the shim finds required files: http://dev.clojure.org/jira/browse/CLJS-1444
@martinklepsch: For anybody interested in node.js the other ticket to look at (and patch to try) is http://dev.clojure.org/jira/browse/CLJS-1466
@joelkuiper: @dnolen @richiardiandrea re: cycle.js After talking to the author (great guy!) about the library I got the impression that there is a lot of Not Invented Here in his work. There are some interesting ideas to extract (the specific RxJS + VDOM combination) but I wouldn't recommend it as it is, since it ignores the existing ecosystem and pretends to be a standalone final solution...
@bensu oh, nice. missed your last comment there.
Hi there. I only have a basic understanding of clojurescript, but I’m fairly comfortable with javascript, and I was hoping I could ask for some pointers on what the equivalent cljs ought to look like, because I couldn’t see an example on this site: http://himera.herokuapp.com/synonym.html
If I want to use an existing js library, like http://momentjs.com, and call moment().format('L');
what would the equivalent clojurescript look like? Something like ( js/moment ( js/format ‘L’) )
?
@mikethompson: That penny kept falling through to me as well - time to finally get rid of those pesky deprecation errors
(.format (js/moment.) “L”)
delaguardo: thanks! So as long as that js file is included on the page and loaded before clojurescript’s compiled javascript, I should be able to call it freely?
Yes, but there is more native way for external libraries - http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
cool - looking up now
@delaguardo: that should be (.format (js/moment) “L”)
I think
oh, my bad, but
moment()
is just alias for new moment()
so i’m right too)Anyone here build an electron/clojurescript app? Seems like it should be fairly easy but just moving the proper js files into the electron shell. Are there any gotchas or tips to improve the workflow?
@dnolen can you elaborate on "fwiw I think core.async + React / Figwheel has shown that mutable observation is a big tradeoff" re:cycle.js? Or point to any resource explaining it? not quite following.
which you do in the React model esp. if you want stronger state management (time travel)
the issue becomes clearer when you see that React events don’t need explicit addEventListener
or explicit removeEventListener
you see the exact same problem found around traditional JS event handlers in RxJS observe/unobserve
and in core.async loops that need a lifetime
not sure if this is more of a cider question vs clojurescript, but since I’m working in a cljs repl: can anyone give me a pointer on how to get my repl values to be pretty printed? I’m using whidbey for colorizing, but can they also be nicely broken into indented lines?
as opposed to, for example:
cljs.user> {:a {:b {:c :d} } }
{:a {:b {:c :d}}}
@bhauman: I'm trying to start with figwheel 0.5.0 and it complains that Could not locate clojurescript_build/auto__init.class or clojurescript_build/auto.clj on classpath.
I looked through figwheel's project.clj and it's not there
I'm starting figwheel sidecar from a clojure.main REPL. Everything works fine except (reload-config): java.lang.IllegalStateException: Can't change/establish root binding of: autobuild-env with set
Am I missing something in my config/is there a known fix? My friend Google isn't helping
Can’t figure out how to generate URLs on cljs frontend using shared cljc file with silk routes pointing to backend clj handler functions.
@domkm: well, it’s pretty stupid now: https://gist.github.com/vitaly-pushkar/7e3715c8cc99388cbec6 of course cljs cannot ’see' clj handlers, but I actually don’t need it - what I want is to ask silk to give me urls for named routes, to not to hardcore urls on frontend and I can’t figure out how to make it possible
@domkm I can’t run the app. I get adzerk.boot_cljs.util.proxy$clojure.lang.ExceptionInfo$ff19274a: No such namespace: me.front-office.handlers, could not locate me/front_office/handlers.cljs, me/front_office/handlers.cljc, or Closure namespace "me.front-office.handlers”
- it tries to load my clj handlers as cljs which doesn’t exist, obviously
@pshk4r: You'll need to use reader conditionals #?(:clj ... :cljs ...)
to conditionally load code that is only compatible with one environment
@pshk4r: Though that's a general issue, I don't yet really understand what you are trying to do with Silk
@domkm, Let me try to rephrase it: I want to have one shared place between frontend (with cljs Reagent) and backend to define routes in. So whenever I need a link on frontend to point to pages which are not part of SPA (for example, /registration or /about ), I could use named routes instead of hardcoding these urls. I am pretty newbie here, maybe I get the whole thing wrong and trying to do something illogical.
@pshk4r: Here's a good primer on reader conditionals: http://danielcompton.net/2015/06/10/clojure-reader-conditionals-by-example