This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-20
Channels
- # admin-announcements (2)
- # beginners (38)
- # boot (12)
- # business (2)
- # cbus (2)
- # cider (8)
- # cljs-dev (32)
- # clojure (154)
- # clojure-brasil (43)
- # clojure-czech (3)
- # clojure-dev (5)
- # clojure-germany (1)
- # clojure-japan (2)
- # clojure-nl (2)
- # clojure-poland (9)
- # clojure-russia (29)
- # clojure-sg (12)
- # clojurescript (147)
- # clojurex (22)
- # community-development (2)
- # cursive (8)
- # events (3)
- # ldnclj (30)
- # ldnproclodo (1)
- # leiningen (1)
- # luminus (34)
- # off-topic (6)
- # om (255)
- # re-frame (1)
- # reagent (22)
- # rum (2)
- # yada (1)
@gabe: https://github.com/gf3/secretary is pretty popular last I checked.
@potetm: that’s what I figured. I saw bidi as well and wanted to hear people’s take either/both
hello guys, what do I have to require in order to rebind err ?
can't understand why cljs.core/err does not work
ah of course, there is no err in cljs.core...
I'm looking for a way to go from markdown to hiccup-like data, using clojurescript on node. Has anybody done anything like this?
I've tried to go from markdown to html using https://github.com/yogthos/markdown-clj, and then from html to hiccup with https://github.com/davidsantiago/hickory, but the latter appears to depend on js interop that is only available in a browser environment
mmm...never tried...if you do it though, let me know because it could be useful for testing my https://github.com/arichiardi/reactive-markdown
actually i could use markdown-clj
actually my library makes little sense now that I have see what
markdown-clj
does 😓@gabe: I, for one, us bidi; I like being able to share the routes between frontend and backend and the fact that routes are not magical macros but just plain datastructures.
+1 bidi. routes as data is very useful
Except the part where the route definitions are a bit finicky and slightly unreadable (I'm never 100% I put the right amount of brackets), but that's a small price to pay to be able to share routes and get reverse routing, since you can just split the routes into several def/defns.
…and some of us think that "routes" are the wrong approach altogether (Rails heritage) and use URLs split into tokens to provide composable mapping of URLs to components.
@jrychter: how would that work exactly? And if I'm getting that right wouldn't giving a component it's own subroutes that are then composed into one big route map of all components when the system boots be isomorphic to that? Something like modular does.
@jaen I have to write it up, because I end up explaining it (badly) often… Basically, you split the URL into tokens and pass them down the component tree. A component has the option of consuming some tokens. Which means there is no single "routing table", which means you are free to move components around without maintaining routing information in two places. I don't know the modular approach — but I guess you might build a declarative system where a global map is built from all components. Sounds complicated, though.
@jaen There are drawbacks, so it's not all roses — but I'm pretty happy with this approach so far. The major drawback is that you need to explicitly pass additional params down the component tree.
It basically just has a protocol called RouteProvider
that returns a route subtree which then it collects from the constituent components and builds the route map. But yeah, I think it might be more complicated to implement than what you're describing, since in your case there's no need to gather all the route subtrees, since you walk the component tree on each request.
Here's the relevant code if you're interested - https://github.com/juxt/modular/blob/master/modules/bidi/src/modular/bidi.clj#L12-L20
@jaen You also don't get "full" reverse routing — building URLs within a component works fine, but for global links I just write functions that explicitly build them. So far this has been OK for me, because there are typically quite few "global" links. Most navigation happens with a component (menu, tabs, whatever). And you don't get "shared" client/server routing, which isn't a problem if you build isomorphic apps.
As for not having isomorphic routing - well, if you venture into components I guess that's one thing you have to sacrifice
I don't imagine it would be easy to get full routes from a system if it's instantiated only at runtime
Hi all, is the es6/amd/commonjs module support for cljs actually done or is it still a wip, I can't see a reference to it here: https://github.com/clojure/clojurescript/wiki/Dependencies but it is referenced under compiler options here: https://github.com/clojure/clojurescript/wiki/Compiler-Options#foreign-libs
@itrillian: still WIP
@itrillian: you can use it for single files with :foreign-libs
I think?
@itrillian: It depends on what you want to do. There is already very basic support for JS modules.
@jaen: Well, you can actually already include multiple files as longs as they are using relative paths for their requires 😉
@itrillian: here - https://github.com/clojure/clojurescript/wiki/Compiler-Options#foreign-libs
@maria I'm trying to make a case for clojurescript to use in an upcoming project at work, but there are some concerns, one of them is how much trouble it is to handle foreign libs, so I'm wondering if the cross modules feature is actually ready to use in a production environment since we already have some other homemade libraries that use commonjs modules for example
@jaen yes but I found it strange that it was not referenced on the dependencies page
@maria: ok, fair point, though this still limits it to small and simple pieces of code (preferably you have ownership over), no one in their right minds would want to specify all 170 files of React by hand (at least I know I wouldn't which is why I started working on it)
@itrillian: I wouldn't know why exactly, but I guess that's since it's still work in progress
@itrillian: You can have a look at a small example project here where I am including React as a CommonJS module https://github.com/mneise/circle-color
You can process single files with relative requires by specifying them all in :foreign-libs
, but anything bigger is not really supported outside of my fork (and it doesn't yet support everything either)
@itrillian: Or here is another example where I am including CodeMirror and hammer.js as CommonJS libs https://github.com/mneise/cljs-present/blob/master/scripts/build.clj 😉
Yeah, still working on it though, but already used it for a small presentation (http://mneise.github.io/talks/2015-09-15-akjs/index.html) 😉
@itrillian: It really depends on what you are trying to do. Someone at a meet up told me a couple of weeks ago that they are already using JS module support in production for their own existing CommonJS libraries. But if you are expecting it to work out of the box with most libraries on npm, this will not be the case.
@itrillian: basically your best bet right now is to use browserify/webpack/whatever-is-the-node-flavour-of-the-month to preprocess your files by removing modules and put that in :foreign-libs
as plain JS libs. Otherwise if your lib is simple enough you might follow what Maria did in her samples and use her :foreign-libs
module options.
@maria: ok thanks for the info 😃 will have to investigate how much impact that will have with our own libs
FWIW: The React community finally had to move away from Slack (hit the user count limit) and now they are using Discord, which is built on React and React Native.
There’s a #C0CB40N8K channel if people are interested discussing this kind of stuff.
I ended up starting w/ bidi last night. I’m using it for the front-end and like that I can see my app layout as a route tree. All those nested maps and vectors take a bit of getting used to, but I think overall it’s a good approach
But isn't gitter centred on one project and doesn't have subchannels? At least, I didn't notice it having them.
There’s a way to get subchannels in Gitter.
why Atom doesn't implement ISwap and IReset, but there is special case in swap! and reset! functions? For performance reasons?
how do you refer to module.exports in a clojurescript file?
@jeremyraines: what do you want to do exactly? But if you want to access module.exports
then probably that's not something Clojurescript (yet) support.
trying to use / translate this: https://github.com/dhleong/expressive
the last line, which sets it up to run on Lambda, is app.handle(module.exports
. . . I just found something I’m going to try which is (.handle app (.-exports js/module))
might be right, but either I don’t understand lein-cljsbuild yet (likely) or the fact that this example doesn’t actually set anything to module.exports causes the generated js to be northing but the goog.require bits
yeah, I haven’t tried using cljs with nodejs. Feels too hacky at this moment. Maybe in the future.
@jeremyraines: you're looking for the cljs.nodejs
namespace
I have it in the project
I usually do something like:
(let [node-package (cljs.nodejs/require "the-package-name")]
(do-stuff))
OK, thanks. I think I’m able to use packages
just not export a usable one yet
yeah. Here’s a js file that does what I want:
e.g. just export one function
I feel like I can get there, but this example (which is a nice library wrapping the functionality I need to put in that function):
only wraps module.exports
either way, I’m studying how this project does it . . . and it’s considerably harder than I would’ve imagined
specifically: here https://github.com/nervous-systems/cljs-lambda/blob/master/plugin/src/leiningen/cljs_lambda.clj#L16
where they do some templating to generate (before? after? during?) the actual cljsbuild
okay, got it. I don't have any experience using cljs code from javascript land, but I am familiar with cljs-lambda
yeah, I see that now. Starting to get it but I wouldn’t call it easy
thanks for clarifying that that was the mechanism
anyone know why I might be getting this error when compiling to js:
java.lang.RuntimeException: No reader function for tag js
is there something I need to require in the ns for #js {:some “object”}
to work?
ugh . . . .clj
I forgot to rename it; time for a break. thanks
Anyone that wants to chime in? https://www.quora.com/Programming-Languages/Clojure-style-domain-modelling-in-Java-or-other-mainstream-languages
@borkdude Have you checked out prismatic's schema?
@angusiguess: yes, I use it. What about it?
Well I suppose one way we could think of schema is for domain modelling, in that we use it to define constraints around our data and how it flows through the system. I'm not super experienced in domain modelling but isn't schemafying collections sort of like defining value objects, and don't functions act as relations on value objects?
sort of yeah. Schema is more a validation library. You don't construct data with it.
is the correct way to stop eventPropagation on a react event?
:onClick (fn [e] (.-stopPropagation e))
@blissdev Might be wrong, but looks to me like you’ve got a hyphen in there which will cause problems
The kind of silly errors that would be avoidable with a type system, alas we all code in a dynamic language ; d
In what version was JSDoc compile-time checking (https://github.com/clojure/clojurescript/wiki/Compile-Time-Type-Checking) added to ClojureScript? I’m having determining that from the changelog, and trying out examples doesn’t seem to be working for me.
@cigitia: Start looking from here http://dev.clojure.org/jira/browse/CLJS-1069 onwards
yet another place for someone to do some impactful yet pretty straightforward compiler work
Is anyone familiar with how core.async is managed as a dependency within clojurescript? I am trying to use the “poll!” function, but I get the message: "Referred var cljs.core.async/poll! does not exist”. Is cljs.core.async distinct from org.clojure/core.async?
@chris-andrews: there hasn’t been a core.async release in over a year. unfortunately the current release does not have that function
@jr: Thanks, and bummer. Do you know if the clojurescript core.async is accessed via the clojure core.async package? If so, I could install a snapshot locally and use it. But since you require it via cljs.core.async I’m not really sure what that resolves to
the core.async repo provides both namespaces but I’m not sure how to compile and package it
I think there are issues with some new features of unreleased core.async so I wouldn’t recommend using it until the core team works it out
ok, thanks for the input. I’m really just trying to find an easy way to flush a channel for ui events, maybe it’ll be easier for me to just find a better way to do that
@jr: Won’t into
also close the channel? I need to keep using the channels, but get rid of any old mouse move/click events
Maybe the best workaround is to just close the channels and create new ones?
There are a few places where it’s used, but the gist of it is things like: I’m using sliding buffers of length 1 for mouse down, up, and move. I have some logic where if the first take after mouse down is a mouse up, it was a selection, but if it was a mouse move, then it was a drag. But there will be old mouse events in the buffer that I need to discard.
Probably mixing and muting is the right approach for this. Thanks for all your input though @jr
how anyone gets anything done in JS is a mystery to me ... the React codebase looks like complete chaos to me ... so glad we have CLJS
a question, does ClojureScript creates Namespace objects? in-ns returns nil on success