This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-01
Channels
- # beginners (133)
- # boot (59)
- # cider (5)
- # cljs-dev (30)
- # cljsrn (23)
- # clojure (212)
- # clojure-austin (3)
- # clojure-brasil (1)
- # clojure-chicago (5)
- # clojure-italy (10)
- # clojure-russia (5)
- # clojure-serbia (1)
- # clojure-spec (34)
- # clojure-turkiye (2)
- # clojure-uk (132)
- # clojurescript (163)
- # clojutre (1)
- # cursive (5)
- # datomic (58)
- # emacs (42)
- # events (1)
- # graphql (26)
- # hoplon (16)
- # jobs (1)
- # lumo (27)
- # numerical-computing (3)
- # off-topic (127)
- # om (9)
- # onyx (24)
- # re-frame (20)
- # reagent (20)
- # ring-swagger (14)
- # sql (19)
- # unrepl (28)
- # untangled (3)
- # vim (8)
- # yada (17)
Hey, hi to everyone
I've been thinking of using the new https://github.com/Jarzka/stylefy in my next project, it's a wrapper around Garden for Reagent
I made a CSS modules library for cljs over the last four days (not really css modules as you will see) for my own project, I'd like to get some feedback, Daniel Compton likes it!
It seems that you were even talking about this!
fqcss can be used with plain CSS, SCSS, or Garden, and Reagent, Rum, or anything else, since it only replaces CSS in a string and provides a generic class resolution function
(I use it with reagent and scss)
So: "I'd like for there to be a CSS classname auto-gen solution that -isn't- CSS-in-JS for people who aren't into that" - This is a very generic auto-gen solution indeed
Sorry if I'm spamming this too much but it seems very relevant 🙂
I also have a "let's-improve-bidi's-complex-syntax" namespace if anyone's interested, among other things that came up during the development of a large re-frame app
hi! I'm looking for good clojurescript lib for UML-like drawing. I want to be able to draw entities and relations between them. any advice?
@mike1452 js interop is pretty good, and i’m sure there must be something D3.js based out there that’ll do the trick
@joelsanchez how does that compare with the new verbose syntax for bidi?
@malcolmsparks would probably take a PR to add it to bidi in it's own amespace if you wanted
@mike1452 ClojureScript->JavaScript interop is super nice to work with, so you can use regular JS libraries without much issue. The only exercise might be in writing some wrapper code to make the API you use in the rest of your app more clojure-like - but that is entirely optional. The best CLJS->JS Interop intro I've seen is https://lambdaisland.com/episodes/clojurescript-interop If you compile code intended for the front-end, you'll likely use ":optimizations :advanced" in your CLJS compiler config, if so, everything goes through Google's Closure compiler which cuts away unused code resulting in a smaller JS bundle. If that is the case, you'll have a little work defining an "externs" file, basically clojurescript file wherein you list the functions of the js lib(s) you want the bundle to contain. Sometimes, this work is already done by others, the best place to look for "wrapped" JS libraries, that is, libraries available at clojars etc which contain these externs files already is http://cljsjs.github.io/
@pseud @robert-stuttaford thanks! mxGraph looks good from JS world.
I'm having an issue with go-loops (which I'm using to help components communicate across the tree) - it doesn't seem like you can print to the console from within them (which is making things a nightmare to debug). Is there a workaround for this?
@carter.andrewj logging should just work?
Nope - tried that, nothing reaches the console
(But the loop actions are still occurring)
Yeah, it's still changing things in the app state
The go loop (in question) is for analytics components to request data from a central manager - all the components are registering themselves successfully and the data is being pulled down, but then no data reaches the components
I can print at the beginning and end of the go-loop chain, but nothing inside the individual go blocks comes out
There's probably just a simple bug somewhere in there that's causing the data to become nil, but I can't track it down because I can't find where that's occurring
Yes, they're doing what they should - but any attempt to output to the console just doesn't appear
Yeah, still nothing
So the map
there executes fine
The state isn't updating properly (which is what I'm trying to diagnose) and the print doesn't do anything
The recur is lower down
There are different when
statements
The (recur)
hits at the end
Multiple components register themselves successfully with the 'update-query!' call, so I can confirm it's executing
Both are valid and work - I'd been informed that specifying the mapping with keywords told the compiler to use keywords for access, which is quicker
Well I've no idea if it's any more efficient or not, but those two lines above both work
Prints at the start, but then not again
Same whether its inside out outside of the when-let
Not from that print statement
you should try to reduce the code in the go-loop anyways, its doing way too much stuff that doesn’t need to be async
I tried to make a project in Elm. Their union types aren't polymorphic. I'm sorry I ever doubted you, ClojureScript ❤️
@captainlexington @dnolen , in case you are still interested in the (take 100 (take-nth 10 (iterate update-fn initial-state))) discussion from yesterday. I rolled my own function
(defn take-thin [take thin transition initial-state]
(loop [iter 0
acc '()
acclen 0
state initial-state]
(if (= take acclen)
acc
(if (zero? (mod iter thin))
(recur (inc iter) (conj acc state) (inc acclen) (transition state))
(recur (inc iter) acc acclen (transition state))))))
and it appears the garbage collector is kicking in from time to timefor basic example, the following agree
(take-thin 10 15 inc 1)
(take 10 (take-nth 15 (iterate inc 1)))
just the new function seems to allow the garbage collector to free up heap space for methis is all ive been able to come up with 🙂
When when I use (.addEventListener js/window "scroll" scroll-fn) works, but is not working with advanced compilation. I can see Uncaught Error: [object Event] is not ISeqable. I don't know why. If i turn on peudo-names to see where is the problem works again.
Yes, I think so. Because, if I turn pseudo names or change the compilation mode works
:advanced
will rename unknown things, :pseudo-names
will rename it as well, just give it different names
so if it were to rename (.addEventListener js/window "scroll" scroll-fn)
anything in here
{:keys [position node multiplier]}
doesnt work if that is called by the native event handler
No error without the line ;; _ (.addEventListener js/window "scroll" scroll-fn) in advanced compilation. So, should be that. The thing is that I don't know why.
I’d love to know if --check
would find the error but probably too much work just to test
@dominicm Tried to mimic Angular's routes, a little bit
The focus is readability.
The routes are nested using their names
{:route :backend :name "Administración" :url "admin/"} {:route :backend.users :name "Usuarios" :url "users/"}
The second route has this url:
admin/users/
I find it very convenient!
I'll generate those routes for you to see
cljs.user=> routes ["/" {"admin/" {"" :backend, "users/" {"" :backend.users, [:id "/edit"] {"" :backend.users.edit}}, "login/" {"" :backend.login}, "register/" {"" :backend.register}, "playground/" {"" :backend.playground}}, "" {"" :frontend, "/index" {"" :frontend.index}, ["/product/" :id] {"" :frontend.product}}, true {"" :not-found}}] cljs.user=>
More readable here: https://gist.github.com/JoelSanchez/3087386fe76202c711a2e323a6cca0b1
Sorry I do not know how to send core
I di dthis 🙂 http://app.klipse.tech/?cljs_in.gist=SevereOverfl0w/c0be19845ebd1c5369475c59767cdf67
I see, what do you think? You find it useful? Is it worth publishing it or something? Idk
I've pinged it over to bidi maintainer for you 🙂 I think it's a novel approach. Worth having out there. People have issues with bidi's syntax.
Thank you!
Quick naive question: If I want to deliver a clojurescript program to a customer using node.js, will the js output of clojurescript's compiler suffice, or is there an additional step required to "package" the javascript in some way for node.js?
depends on your customer, if they are able to install node and run it from command-line with your javascript as an argument you don’t have to package it
In Clojure, "lein deploy clojars" lets you deploy something for public consumption. "lein uberjar" lets you build a jar to deliver to a customer who is not running Clojure. What are the equivalents in node.js world? Most of the npm docs I've found seem to be more about consuming modules and publishing for the public, rather than creating a private module for a single user, so I'm not sure what to search on to find the right kind of docs (or if it's even needed).
any hints on creating a custom writer for cljs.pprint/pprint? for example I'd like to write the pretty string using document.write
+1: cljs.user=> (with-out-str (cljs.pprint/pprint {:a 1})) "{:a 1}\n"
yeah, I was just looking for an example, like this one: https://github.com/binaryage/cljs-oops/blob/ebab0b6489223917c61512576dff48f4711df47e/src/lib/oops/helpers.clj#L14-L19
wondering if out is a thing in cljs
nevermind: (core/defmacro with-out-str [& body] `(let [sb# (js/goog.string.StringBuffer.)] (binding [cljs.core/print-newline true cljs.core/print-fn (fn [x#] (.append sb# x#))] ~@body) (cljs.core/str sb#)))
looking at that maybe you could bind print-fn to document.write