This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-24
Channels
- # admin-announcements (1)
- # aws (3)
- # beginners (52)
- # boot (150)
- # braid-chat (1)
- # braveandtrue (5)
- # bristol-clojurians (2)
- # cider (21)
- # cljs-dev (1)
- # cljsfiddle (1)
- # cljsjs (5)
- # cljsrn (4)
- # clojars (3)
- # clojure (236)
- # clojure-berlin (2)
- # clojure-czech (1)
- # clojure-madison (1)
- # clojure-russia (164)
- # clojure-sdn (1)
- # clojure-sg (2)
- # clojure-uk (64)
- # clojurescript (149)
- # core-async (31)
- # cursive (33)
- # datomic (2)
- # devcards (5)
- # funcool (3)
- # hoplon (142)
- # immutant (27)
- # juxt (7)
- # lein-figwheel (6)
- # liberator (6)
- # off-topic (4)
- # om (46)
- # onyx (26)
- # parinfer (5)
- # perun (56)
- # proton (6)
- # re-frame (19)
- # reagent (1)
- # remote-jobs (12)
- # ring-swagger (17)
- # slack-help (2)
- # spacemacs (11)
- # specter (1)
- # untangled (11)
- # yada (3)
@weavejester: Sweet, seems like an obvious way to do it.
Did you have to keep the events in sorted order by some priority? I was doing that for a bit, but if I break it up into 3 handlers I don't seem to need it. Like a remove entity event that comes before update entity.
Hello. I am new to Clojurescript RN. I am testing Luno sample which has tab bar controller. But, it doen’t act like native (iOS). Is it native?
@domainmoon: it would appear that it’s using ReactNative’s TabBarIOS
(see https://github.com/alwx/luno-react-native/blob/master/src/luno/ios/ui.cljs#L9 , http://facebook.github.io/react-native/docs/tabbarios.html#content)
@base698: No, I didn’t sort the events. A remove entity event just invalidates an update if the update comes after the remove.
Shameless newbie gimme-da-codez question:
What is document.body.style.backgroundColor = "green";
in ClojureScript?
Looking to change the background color of a reagent app, and seeing this http://stackoverflow.com/questions/25474803/trying-to-use-react-dom-to-set-body-styles
Right, duh, I'd just forgotten the set!
-- yes, so I get tangled up in the various furs of CLJS/JS interop...
I'm not sure if it's proper HTML, but I've put a <style> tag inside the body of my view. In Hiccup: [:style "body {background-color: green;}"]
. (I generate the CSS using garden.)
Oh wow fasiha, so then you can just have a function pop that pill in there as needed, and remove as well?
I'm not sure how robust that is. In plain HTML, one puts <style> inside <head>, but I tried putting it inside my top-level application <div> and it worked in Chrome ¯\(ツ)/¯
You guys wouldn't by chance know how feasible it is to use medium-editor (from cljsjs) in Reagent...?
hi guys I have this error while trying to setup cljs.test with lein doo :
(ns my-project.tests
(:require
[clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[cljs.test :refer-macros [deftest is are testing]])
(:require-macros
[clojure.test.check.clojure-test :refer (defspec)]))
(deftest testett
(is (= 2 2)))
(defspec first-element-is-min-after-sorting ;; the name of the test
100 ;; the number of iterations for test.check to test
(prop/for-all [v (gen/not-empty (gen/vector gen/int))]
(= (apply min v)
(first (sort v)))))
The error I got
debug.html:38 Fail (first-element-is-min-after-sorting) (TypeError:NaN:NaN)
Expected nil
Actual: #object[TypeError TypeError: Cannot read property 'call' of null]
The test in deftest ran just fine. Are you guys have any idea why it does wrong ? THanks@nxqd have you tried a simple (= 1 1)
in the body of your property test?
Just to make sure it is written right?
@danielcompton: ah I got you. You meant in test.check
(defspec first-element-is-min-after-sorting ;; the name of the test
100 ;; the number of iterations for test.check to test
(prop/for-all [v (gen/not-empty (gen/vector gen/int))]
(= 1 1
)))
Try simplifying v to be gen/int
@danielcompton: I got another error:
Fail (first-element-is-min-after-sorting) (TypeError:NaN:NaN)
Expected nil
Actual: #object[TypeError TypeError: Cannot read property 'call' of null]
FYI: I got a warning that karma doesn't get the cljs_deps. But due to the docs from doo, it seems to be fine since it's included in the page itself. I do check that it's already included through /base/..../cljs_deps.js
. Just in case you need this kind of information.
gotta go sorry, good luck!
@danielcompton: problem fixed, forgot to add :include-macros true
to properties for clojurescript -_-
Combining ClojureScript with JS libraries is still a bit of a dark area to me. Someone could point me in the right direction?
@slotkenov: something to know is that it makes a lot of sense to leverage existing Google Closure libraries, also there is cljsjs as well
Yeah. What I’m trying to do here is make use of a generated code for a client to a REST server defined by a swagger contract.
I am trying to use http://www.material-ui.com/#/components/raised-button but can’t use the icon property. I keep getting the following error:
Warning: Failed propType: Invalid prop `icon` supplied to `RaisedButton`, expected a ReactNode. Check the render method of `reagent6`.
(defn main-panel []
(reagent/create-class
{:reagent-render
(fn []
[:div [(reagent/adapt-react-class js/MaterialUI.RaisedButton) {:onClick (fn [_] (println "clicked!"))
:className "material-icons"
:icon [:i {:class "material-icons"} "favourite"]}
"home"]])}))
I have this interesting problem where merely adding a go block makes an Om component fail.
buuutttt this works!! (reagent/as-element [:i {:class "material-icons"} "search”]) awesome! thank you very much!
It looks like Clojurescript doesn’t warn when you call an anonymous function with the incorrect arity. The bugtracker indicates that it is fixed (http://dev.clojure.org/jira/browse/CLJS-361), but Clojurescript 1.8.34 doesn’t warn when I execute this code:
(defn hello-world []
(fn []
(println "hello!")))
((hello-world) "1")
Am I doing it wrong…?I tried it on my local replumb instance and I don't see warnings either
@stex it’s possible it’s a regression - file an issue with that example in JIRA please - thanks
@dnolen: I’ve just re-read https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure and it states "here is currently no runtime enforcement of arity when calling a fn”. It seems like this is by design, or do I misinterpret the text?
@stex that said I looked more closely at your example - we don’t handle that particular case actually
Ok, thanks for the quick response! I’ll file a ticket tomorrow 😉.
Advanced compilation is not eliding dead code as I would expect it to. With goog.DEBUG
as false
, (when ^boolean goog/DEBUG (devtools/install!))
causes cljs-devtools to be included in the advanced build even though that is the only use of cljs-devtools in the project. Any ideas why it's not being elided?
Hmm, it looks like simply requiring cljs-devtools causes it to be included in advanced build without even invoking it. I guess it's messing with the global environment by default so GClosure is unable to determine that it should be elided. CC @darwin
@domkm: cannot comment on this without investigating it, but there is a reliable solution how to exclude devtools in release build, use different :source-paths and do not include devtools-related files in release build
I have one experience with DCE not working as expected when under :advanced optiomizations, when I store function reference to a map under a key and that key is never accesssed/used, the function still doesn’t get removed as a dead code
had a config map working this way and then had to generate it via a macro, to work around this problem
@darwin That would undoubtedly solve the issue but it's less convenient and, given GClosure's advanced DCE, shouldn't be necessary
@darwin that function in a map problem is likely due to GClosure not understanding CLJS data structures
I agree, would be great if you could find the actual reason why is it not removed, maybe it has some reasonable explanation which could be worked around
@darwin: many of those defs compile to immediately invoked functions which, as far as GClosure can tell, are impure and therefore cannot be elided
if defs are problem, why defns aren’t? defn compiles down to something like (def x (fn …))
@darwin: the issue, I think, are things like '(def foo (if ... ...))' because they immediately do something which could be side-effecting
@domkm: can you point me to some instance of this in cljs-devtools code? I don’t see it anywhere
I will go ahead and add a new profile into cljs-devtools-sample with your usecase under :advanced build and test it there
https://github.com/binaryage/cljs-devtools/blob/master/src%2Fdevtools%2Fsanity_hints.cljs#L36
Possibly this as well https://github.com/binaryage/cljs-devtools/blob/master/src%2Fdevtools%2Fprefs.cljs#L10-L139
https://github.com/binaryage/cljs-devtools/blob/master/src%2Fdevtools%2Fformat.cljs#L343-L346
https://github.com/binaryage/cljs-devtools/blob/master/src%2Fdevtools%2Fformat.cljs#L364-L366
Hi, when I start figwheel (in Cider or as lein figwheel) I get such warnings: WARNING: Unknown option ':compiler-env'. WARNING: Unknown option ':init'. Did you mean ':main'? WARNING: Unknown option ':special-fns'. WARNING: Unknown option ':bind-err'. WARNING: Unknown option ':warn-on-undeclared'. WARNING: Unknown option ':quit-prompt'. Could you point me where I could find this settings? What should I do with them? Thanks in advance
@domkm: just added some dirty code to test differences between advanced builds into cljs-devtools-sample: https://github.com/binaryage/cljs-devtools-sample/commit/bbaee2b3d58c00d6dd64f88ee053ea01db42f14b
results on my machine are here: https://gist.github.com/darwin/d40a4b62ae67446db55b
conclusion: eliding works, but not using your method, the optimizer does not seem to understand js/goog.DEBUG
but there is still room for improvement on cljs-devtools side, because some stuff gets generated even in minimal case (no-install)
and bunch of methods in devtools.dirac namespace have ^:export set, so they force some parts to be included
You need to specify goog.DEBUG
as false so that GClosure knows the value ahead of compilation
I have had weird behaviors with goog.DEBUG
too lately, why do I need ^boolean
?
in my case it was like this: (when goog.DEBUG (print (make-warning-fn# %)))
but the print was always executed
in replumb tests
@richiardiandrea JS truth is different than CLJS truth. If you don't add ^boolean
, CLJS will wrap it in a check to make sure it is null
, false
, or undefined
(I think) but not 0
or ""
. GClosure doesn't know about this truth check nor can it infer the result of the check, so it cannot elide a conditional based on it. ^boolean
tells CLJS that the return value of the expression is a boolean and therefore it doesn't need to wrap it in an additional truth check.
so far if goog/DEBUG
behaves the same as in my previous case even with closure-defines
(not a really JS guru here)
will try that too, maybe you solved too problems at the same time 😉
@domkm: works! https://github.com/binaryage/cljs-devtools-sample/commit/755dcd6117bddf0222dc04ecaf5c9b744d9a6f2f
I don't even know if getting rid of ^:export is necessary. I'd be curious to know either way.
no worries, I will let it configurable via ENV, and generate that api dynamically when enabled (via macro I guess)
maybe dirac support should be completely decoupled from cljs-devtools as a separate library
Anyone know if it's possible to output ES6 from ClojureScript? Specifically, I'd like to output a class definition.
@domkm: not possible
@anmonteiro: Okay, thanks.