This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-18
Channels
- # architecture (14)
- # beginners (89)
- # cider (336)
- # cljsrn (2)
- # clojure (181)
- # clojure-berlin (1)
- # clojure-dusseldorf (3)
- # clojure-finland (4)
- # clojure-germany (5)
- # clojure-italy (18)
- # clojure-norway (10)
- # clojure-spec (9)
- # clojure-uk (94)
- # clojurescript (84)
- # cursive (3)
- # data-science (4)
- # datomic (82)
- # emacs (2)
- # events (4)
- # figwheel (1)
- # fulcro (6)
- # graphql (2)
- # hoplon (46)
- # instaparse (24)
- # jobs (9)
- # lein-figwheel (2)
- # luminus (18)
- # lumo (3)
- # mount (1)
- # off-topic (14)
- # onyx (17)
- # parinfer (22)
- # planck (1)
- # protorepl (1)
- # re-frame (50)
- # reagent (7)
- # ring-swagger (6)
- # rum (4)
- # shadow-cljs (94)
- # spacemacs (9)
- # specter (7)
- # tools-deps (2)
- # uncomplicate (4)
- # vim (33)
Do people here have recommendations for some good, upto date sources to learn clojurescript?
Not completely up to date, but you can get a long way by reading "Clojurescript up and running" and maybe "Web development with Clojure" for the principles, then study the intro guides to various libraries. (re-frame springs first to mind, but there are lots). If there is a better/easier way I would like to know about it too....
A quick note for any CIDER or piggieback users here:
* CIDER’s master just dropped support for piggieback 0.2, so if you see some odd errors on start-up you need to update to piggieback 0.3
* piggieback 0.3 was new coordinates - it used to be cemerick/piggieback
, now it’s cider/piggieback
. Also - it used to live on Maven Central, now it lives on Clojars
* piggieback 0.3 doesn’t support rhino anymore - just use the much better Nashorn instead
Sorry about any inconvenience this update might cause, but I promise you this is a one time deal!
hi, I'm trying to use http://idangero.us/swiper lib. Having function Swiper() {}
in externs.js file is enough to create the instance of js object of Swiper, but I can't figure out how to declare .slideNext
method of that instance.
If Swiper is a class, then Swiper.prototype.slideNext = function(){}
What do you mean with remote streaming, consuming a stream from a websocket or something? Or producing click events or something?
both. in this case i have a stream of user inputs that i want to send to a remote function and process the response
i control the function on the server and right now it is just req/res but i want to change it to take a stream and return a stream
and using ajax/POST exactly like before. in that case the correct response is visible in the developer console but the handler gets called with nil
so yeah i think i need http://socket.io or something
You have multiple options, I like working with a web socket and have a clojure backend.
@tomaas maybe externs inference can help you identify the problem https://clojurescript.org/guides/externs#externs-inference
If I have a JS object literal like #js {"foo" "bar"}
, Closure advanced compilation can rename foo
, right?
Hey all, does anyone know about a good tutorial for working with npm modules, and/or wrapping an npm library for use in multiple projects?
I was trying to wrap a lib called data.task
, but I could not get it to work properly, in the figwheel repl, I could require it, but it gave me an instance of module (like if it was calling new Task
on require, but the module actually exports a constructor that has some methods associated with it, like .of
and .resolved
). In the file I could not even require it, it either returned an error (because of the dot in the module name) or it returned nil
if I quoted the module name.
I was using npm-deps
, but If there a better or more reliable way? What's the story with npm and cljs?
@diego.vid.eco the npm-deps
feature is alpha and in my experience pretty tricky to use. i think what you are asking is how to use an npm module from cljs, right? the two approaches that seem to work reliably are (1) use webpack to bundle up your javascript before you use it or (2) use shadow-cljs and just require npm modules directly. https://gist.github.com/jmlsf/f41b46c43a31224f46a41b361356f04d
thanks @U8ES68TGX I'll check that out
question: are there any examples of a library or framework that allows you to bundle a data query (a la Om.Next, Apollo, Relay, etc.) with a reagent component?
I’m documenting an old cljs on node project, and I could have sworn I had cider jumping to definition and a repl running. Does anyone recall how to do this?
The repl seems to be running ok, but the jump-to-definition integration does not work.
Where is the behavior of the deps.cljs
file documented? I see it mentioned by example on the website but I can’t find a reference for how it works. Is the name deps.cljs
hardcoded? Can it contain anything other than a :foreign-libs
key?
a great way to make this request is with an issue on https://github.com/clojure/clojurescript-site/issues
I've found a few places where deps.cljs
is used, when I was looking into it the other day
Here's the announcement post: https://cljs.github.io/news/0.0-2719
I'm trying to set up an event that will look into the reagent db to figure out another event it needs to call, based on what else is going on in the ui. So, for example, the db would have something like :my-event ::request-stuff
. In the first event, if I do the following:
{:dispatch [::request-stuff]}
Everything is cool and works right (`::request-stuff` is in the same area of code as the first event that calls it, by the way). But if I set up a let statement with a variable "my-event" getting what's in the db (and I've verified that it pulls back "::request-stuff" as its value), and call:
{:dispatch [my-event]}
My dev console will then tell me re-frame: no :event handler registered for: ::request-stuff
. Is this because I need a more explicit way of calling ::request-stuff
?Is there a tldr guide to using es6 module with react dep in a reagent/re-frame project? Thanks in advance
Use shadow-cljs. There’s a gist I posted earlier in chat for more details. On phone right now tho
thanks mate!
@captaingrover I’m assuming you’re asking about how to go from JSON to EDN
so now i'm splitting off the end, using .parse js/JSON
and then js-clj
but i still wind up with the strings for keys
everything resolves around this decision which I would argue is probably not a good idea
i would like to use Transit. The server is Java/Spring and i'm not aware of a way to do that
@captaingrover you can use cljs.reader/read-string
on that "[3, 2]"
value to get it read in as a vector
But to david's point, doing so is probably just putting a bandaid on a problem that is not yet fixed somewhere else.
one could also copy&paste js->clj
implementation and make keyfn
optionally specified by the caller, e.g. doing there read-string
or whatever, https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L10566
The user might want "value" to be "value"
sometimes and :value
other times, while also dealing with "[3, 2]"
correctly. Not enough information in the example to know, but it sounds hairy.
user is inputing "3,2" or "3&2" and i am caching calculations that would apply to any representation of [3,2]
Yeah, you can handle this stuff manually with read-string, but if you end up building a system of any decent size - with lots of different API endpoints and datatypes moving back and forth - you'll probably want to grab for something like transit
You'd probably have to use https://github.com/cognitect/transit-java server side
I am using fspec
on a CLJS app
(s/def ::on-submit (s/fspec :args (s/cat :event map?)))
(s/fdef some-component
:args
(s/cat :props (s/keys :req-un [::on-submit]))
:ret vector?)
using fspec
seems to increase load time by 12 secondsI am also using expound.
Is this due to how fspec
is being instrumentated?
I have a table on the front end. it only has about 15 rows, and 6 columns per row
When I try to access this page, it take 15 seconds for the table to load
However, if I remove fspec
it takes about 1s
There is this issue https://dev.clojure.org/jira/browse/CLJS-1701
Is your load time issue occurring with :advanced
, or is just a dev-time thing?
Just dev-time
@tkjone something to consider, yes spec could be made faster, but also maybe you don’t need it on UI components at runtime
FWIW, in my own experience using it as a kind of type system doesn’t consistently pay its way
Is fspec used at runtime by default?
I thought you would have to configure it to do so.
In my case I was using it for annotation more than run time validation
re fspec - no