This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-21
Channels
- # beginners (73)
- # capetown (1)
- # cider (13)
- # cljsrn (4)
- # clojure (56)
- # clojure-russia (2)
- # clojure-uk (1)
- # clojurescript (50)
- # community-development (3)
- # cursive (1)
- # datomic (80)
- # defnpodcast (2)
- # emacs (2)
- # fulcro (16)
- # graphql (8)
- # hoplon (206)
- # immutant (43)
- # keechma (4)
- # lumo (4)
- # off-topic (26)
- # perun (2)
- # re-frame (2)
- # reagent (4)
- # remote-jobs (2)
- # rum (4)
- # shadow-cljs (82)
- # spacemacs (5)
- # vim (6)
@alex340 could you show an example usage of your macro? I’m struggling:
(defstyled header :h1 "color: blue;")
(defn hello-world []
[:div {:style {:font-family "sans-serif"}}
[header (:text @app-state)]
[:h3 "Edit this and watch it change!"]])
outputs: core.cljs:305 Uncaught Error: No protocol method ICollection.-conj defined for type string: Hello world!
hmm, I see. by changing it to [header {} (:text @app-state)]
it now works as expected
according to this: https://clojurescript.org/about/differences
Currently ClojureScript numbers are just JavaScript numbers
Yet, I recently learned that JS does not have an integer type, all numbers are 64-bit floats. So how is CLJS int type implemented if its numbers are just JS numbers?@ajs CLJS doesn't have int types...
(type 1)
in cljs returns number
(defn int
"Coerce to int by stripping decimal places."
[x]
(bit-or x 0))
i see, the functions int? and integer? were leading me to believe it did, but i see now they are not what I think they are
Hi. I've been struggling with converting the following javascript into clojurescript, and hoped someone here can help me:
let Inline = Quill.import('blots/inline');
class BoldBlot extends Inline { }
Is it interesting for clojurescript?
with this,
(defn clear-button []
[:a {:style {:visibility (if (str/blank? (@app-state :url))
"hidden"
"visible")}}
[:span.icon.is-right.is-small {:on-click #(.log js/console "hello")}
[:i.fas.fa-times]]])
reagent doesn't render the onClick - when i inspect this button, onClick isn't even there, but if it's
(defn clear-button []
[:a
[:span.icon.is-right.is-small {:on-click #(.log js/console "hello")}
[:i.fas.fa-times]]])
then everything works fine. Why might this be?hold on - chrome's inspector doesn't show <span onClick="blah">
as i was expecting it to
so i'm guessing that the span just got rendered below another element and can't receive the "click"
@ackerleytng React never places the event handlers on DOM. It handles the events internally.
@ackerleytng He means that it registers the event programmatically, that's why it does not show up on the span element in the dom displayed by the inspector.
Your span may not receive the click if it occupies no space on the web page. Double-check that, add some text inside your span tag.
You may try to set pointer-events: none;
on the style of :i.fas.fa-times
and see if it helps.
ah i see
thanks so much!
You're welcome.
I'm pretty sure it's something to do with layering
i'm using bulma and the cross was actually an icon, something like https://bulma.io/documentation/form/input/#with-font-awesome-icons
when i right click on the cross and click inspect, chrome highlights the input and not the span, so i guess bulma might have hidden the cross below
i switched to using a button, as in https://bulma.io/documentation/form/general/#form-addons so that fixed it
The discussion of (.method js/object)
vs (js/object.method)
comes up a bunch and people seem to favor the former. But just to be clear: the latter form is passed through to javascript without being subject to advanced compilation, correct? In dealing with external libraries (without extern declarations), it seems like this is a big advantage.
btw. (.toString #(.method js/object 1 2 3))
produces exactly the same js code, so (I assume) there is no difference when the code gets passed to google closure compiler
@lee.justin.m Just enable externs inference and this will be covered automaticallly
@rauh i guess. the documentation on externs inference is not exactly reassuring. particularly the part where it says (Alpha)
in the title
Well you can always inspect the generated externs in your source folder and see if what's in there. Unless you have thousands you can quicky verify it.
my problem is that it’s just me working on this project. i can’t be going off into the deep end of compiler internals, or trying to figure out some subtle bug with externs, or trying to translate from es7 code. using cljs-oops is dead simple and it will definitely work, so that’s kind of what I’m leaning towards
cljs-oops also has dev-time diagnostics, which could help catch some class of mistakes
all of the documentation on inference and externs and so forth tend to assume that I understand what on earth google closure compiler is doing, and how its type system works. i really don’t want to know about that if i don’t have to
on the other hand, cljs-oops could slow down your compilation times (it uses macros heavily)
thankfully for me that is the least of my worries. i care only about correctness and developer power
personally I’m in the same boat, also cljs compilation is pretty slow anyways, so during development I have to rely on incremental compilation setup anyways
I’m trying to understand how to use shadow-cljs with the macchiato framework that yogthos wrote
I’m not quite understanding how figwheel knows how to start/stop the http server in the template
@lilactown happy to help in the #shadow-cljs chan
With a clj + cljs project developed in cider where we want to share code, should it be 2 Lein projects or one? If one, how do I specify client vs server dependencies?
@alexisvincent you could do either one