This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-25
Channels
- # beginners (26)
- # boot (1)
- # cider (21)
- # cljdoc (26)
- # cljs-dev (7)
- # clojure (99)
- # clojure-gamedev (6)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-russia (1)
- # clojure-spec (5)
- # clojure-uk (59)
- # clojurescript (49)
- # clojutre (6)
- # component (13)
- # core-async (2)
- # cursive (30)
- # data-science (2)
- # datomic (29)
- # emacs (9)
- # fulcro (100)
- # hyperfiddle (1)
- # jobs (2)
- # luminus (4)
- # lumo (23)
- # off-topic (22)
- # other-languages (37)
- # parinfer (1)
- # re-frame (2)
- # reagent (5)
- # reitit (12)
- # ring (12)
- # rum (3)
- # shadow-cljs (168)
- # slack-help (1)
- # spacemacs (7)
- # specter (2)
- # tools-deps (8)
- # vim (11)
- # yada (3)
if a library provides a deftype and some protocols that type might inherit, what is the “hook” they should also expose so you, as the consumer, can provide your own type’s varying implementation of those protocols? do you take in the type to create as a parameter? do you take a created type instance and operate only via protocols on that (who knows?) type?
if a lib doesnt expose an extensible protocol / type properly, how unwise would it be to alter-var-root on their constructor and shimmy-in your own type/protocol impls?
I have a website built in CLJS using reagent. I’m having a problem with password fields, where the :change
event isn’t fired for password fields filled in by the PwdHash browser plugin. I thought it was the order of the :change
and :blur
events that was the problem, messing up my validation, but it seems that I’m not getting the :change
event at all. Any suggestions for dealing with this?
I worked around this by using the :blur
event to copy the field value to the app state atom and validating it at that point.
IIUC re-seq
does two searches for each match of the regexp in the searched string? https://cljs.github.io/api/cljs.core/re-seq
wouldn't it be faster to use the .-index
of the result of .exec
ing the regular expression? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec
cljs.user> (let [m (.exec #"br\w+" "the quick brown fox yadda yadda")]
{:index (.-index m) :text (aget m 0)})
{:index 10, :text "brown"}
@euccastro if the above is a performance win I guess it could be added with some profiling to core? I guess it should be thoroughly tested maybe? Looks good to see it this way - the only thing to avoid being using aget
for objects - it is frowned up 😄
@euccastro This blog post describes ways to measure perf for ClojureScript http://blog.fikesfarm.com/posts/2017-11-18-clojurescript-performance-measurement.html
@mfikes: fair enough, but the use of aref
is besides my point. this works too:
cljs.user> (let [m (.exec #"br\w+" "the quick brown fox yadda yadda")]
{:index (.-index m) :text (first m)})
{:index 10, :text "brown"}
Ah right I thought it was an map object up there :)
I must be very tired ;)
@euccastro I was saying that aget
is correct to use on m
in that case—m is #js ["brown"]
Yep ☝️ sorry
@euccastro If you end up being interested in contributing a perf improvement, there is lots of info here https://clojurescript.org/community/dev, but ask, and especially in #cljs-dev if you have questions
I'll give it a try, thanks! I'm not sure it will be a big win, but unless there are other considerations I'm missing, I can't see how searching once can be slower than searching twice for the same thing 🙂
Hey guys! I'm using pushy
for HTML5 pushState (https://github.com/kibu-australia/pushy). In my project, I need to navigate back to previous route and usually I use history.back(). I've found anything about that in pushy documentation. Any ideas?
I think just use window.history object,
[:a {:on-click #(js/window.history.back) :href "#"} "Back"]
I’m a big fan of figwheel, but I recently heard about browserSync (something similar for JS?), which I’ve really not used. Is it comparable? Which came first?
Correction: recently in this space after reporting #reagent’s susceptibility to glitches I surmised that #re-frame subscriptions would inherit that edge vulnerability. After some fairly abusive testing, it seems not. r/f subs are their own beast, leveraging ratoms but implementing their own glitch-less data flow. Nice!
How can I prevent
SEVERE: ERROR - Duplicate extern input: file:/Users/erooijak/.m2/repository/cljsjs/iota-mam/0.0.1-0/iota-mam-0.0.1-0.jar!/cljsjs/iota/common/iota.ext.js
Jul 25, 2018 3:14:34 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: file:/Users/erooijak/.m2/repository/cljsjs/iota-mam/0.0.1-0/iota-mam-0.0.1-0.jar!/cljsjs/iota/common/iota.ext.js at (unknown source) line (unknown line) : (unknown column)
? 🙂I tried:
[cljs-iota "1.0.1"]
[cljs-iota-mam "1.0.7" :exclusions [cljsjs/iota]]
But that’s not enough.@erwinrooijakkers can you just skip cljs-iota
and use cljs-iota-mam
only
@jmckitrick they are different things
I wonder if anyone has used the jQuery plugin 'fullcalendar' on their clojuscript app. As it isn't listed on cljsjs, I'd like to know what to keep in mind in order to use it.
Thanks @bhauman but then the same error appears strangely enough. Maybe because I published the library locally as well.
So it would not be ignorant of me to pitch figwheel to my team by saying JS has no equivalent ATM?
You do have state-preserving hot code reloading in React for example via https://github.com/gaearon/react-hot-loader. But then you don’t have a REPL nor write in ClojureScript.
there's a suite of bhauman tools that make life amazing for me. I run: cljs-test-display, devcards, site. The test display runs unit tests and gives me favicon display of passing/failing state. devcards so i build my components and can interact with them. this forces me to code in a certain style that makes things more easy to use. and then finally plug into the real app and hook up the IO or whatever
When I use
[cljs-iota-mam "1.0.7" :exclusions [cljsjs/iota]] ;; no cljs-iota
I get the error:
>Compiling [“resources/public/js/compiled/app.js”] failed.
>clojure.lang.ExceptionInfo: failed compiling file:target/cljsbuild-compiler-1/cljs_iota/core.cljs {:file #object[java.io.File 0x44473eed “target/cljsbuild-compiler-1/cljs_iota/core.cljs”]}
When I use
[cljs-iota-mam "1.0.7"] ;; no cljs-iota
I get the same error as with including both cljs-iota and cljs-iota-mam
>>>SEVERE: ERROR - Duplicate extern input: file:/Users/erooijak/.m2/repository/cljsjs/iota-mam/0.0.1-0/iota-mam-0.0.1-0.jar!/cljsjs/iota/common/iota.ext.js
Jul 25, 2018 3:52:14 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: file:/Users/erooijak/.m2/repository/cljsjs/iota-mam/0.0.1-0/iota-mam-0.0.1-0.jar!/cljsjs/iota/common/iota.ext.js at (unknown source) line (unknown line) : (unknown column)Hmm maybe the problem is that both packages have the same externs file name in cljsjs/packages:
$ find . -name "iota.ext.js"
./iota/target/cljsjs/iota/common/iota.ext.js
./iota/resources/cljsjs/iota/common/iota.ext.js
./iota-mam/target/cljsjs/iota/common/iota.ext.js
./iota-mam/resources/cljsjs/iota/common/iota.ext.js
Ah wait no
Just having both a dependency on cljsjs/iota
@jmckitrick I’d be careful about overstating the uniqueness of the repl & hotloading. Try out create-react-app and tell me that’s not pretty slick. The hotloading is just as responsive if not more because the development version of a js stack tends to push less code that cljs. Javascript has a repl and browsers have a console you can jump right into. There was a conversation about why cljs repls are more powerful, but I found it to be splitting hairs. I jump into to a js repl pretty often and use it for similar types of experiments. Cljs is really better suited for repl experimentation, but explaining why is hard.
@lee.justin.m in my experience, explaining is hard but showing how to do it seems to have better results. I, for instance, use Atom for development, and the experience that I always miss on other languages/frameworks is when I have some private part of my code that is failing.
On React, I need to make that part of the code public (probably using something like
), then experiment in the JS console. In CLJS, I just open in Atom my file, add a def
inside the private fn to see what are the parameters that are breaking, then without exiting Atom, start to experiment different values.
Then, after I find out why it's failing, it's just a matter of converting it to a testcase and fix the function
@mauricio.szabo right so it seems to me it isn’t that the repl is better. its that cljs is a language that is better suited to repl experimentation. a skeptic is not going to see the difference between the js repl and the cljs repl, but they should see that the langauges are very different
Good to know, @lee.justin.m
As JS tools become more advanced, I sometimes feel like I’m losing the battle for CLJS. 😕
I’ve converted 2 colleagues so far, and they use similar words: fun, refreshing, etc
I try to use cljsjs.react-bootstrap, but get No such namespace: cljsjs.react-bootstrap, could not locate ...
error.
My :dependencies
are:
...
[cljsjs/bootstrap "3.3.6-1"]
[cljsjs/react-bootstrap "0.31.5-0"]
...
My ns declaration is:
(ns my-app.bootstrap
(:require [reagent.core :as r]
cljsjs.react-bootstrap))
What do I miss?