This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-22
Channels
- # admin-announcements (5)
- # aws (32)
- # beginners (2)
- # boot (51)
- # cider (33)
- # cljs-dev (4)
- # clojure (83)
- # clojure-berlin (11)
- # clojure-czech (23)
- # clojure-poland (3)
- # clojure-russia (51)
- # clojure-seattle (4)
- # clojure-sg (1)
- # clojure-uk (4)
- # clojurescript (48)
- # clojurex (1)
- # datomic (26)
- # devcards (10)
- # devops (12)
- # editors (9)
- # emacs (12)
- # events (1)
- # funcool (14)
- # hoplon (117)
- # immutant (1)
- # jobs (2)
- # ldnclj (32)
- # ldnproclodo (12)
- # om (51)
- # onyx (17)
- # reagent (11)
- # yada (4)
Anybody have any experience with charting libraries and Om? I’ve been having some difficulties with Chart.js that are almost certainly not Om issues but I’m curious what other people are doing in any case
@venantius: I think you can find sth in this repo https://github.com/annapawlicka/om-data-vis
hi! i'm getting WARNING: No such namespace: d3, could not locate d3.cljs, d3.cljc, or Closure namespace ""
warnings when using cljsjs/d3 "3.5.5-3"
with code like (d3/select ".chart")
. the compiled script works fine but the warnings are annoying. am i doing something wrong?
@sander: (.select js/d3 …)
@sander: most cljsjs packages don’t expose closure modules but just load foreign libs, adding things to the global js/
namespace as they would do usually
thanks @martinklepsch, good to know
About devcards with reagent Is there anything special do to on a component that has an internal state (what reframe calls a form-2 https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-2--a-function-returning-a-function)
Beginner Question. Whats the difference between #()
and ()
? e.g. #(swap! atom inc)
@danielgrosse: The first #()
form returns a function, whereas the second ()
actually calls functions.
@jgdavey: okay thanks. Thats declares it. When I return a function, how is it called?
But #(swap! atom inc)
would return a function. It’s really just shorthand for (fn [] (swap! atom inc))
You can call a function by putting it in the “call” position, that is, putting the first in a list: (let [my-fn #(println “Hello”)] (my-fn))
Okay. Thank you.
Can cljsbuild/cljs compile clojurescript to run by nodejs with projectx/target as the root directory? That is, to generate paths relative to projectx/target/ and not prejectx?
fs.js:500
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'target/server-side/react.inc.js'
at Error (native)
at Object.fs.openSync (fs.js:500:18)
at Object.fs.readFileSync (fs.js:352:15)
at Object.nodeGlobalRequire (/Users/pupeno/Projects/ninjatools/target/server-side/goog/bootstrap/nodejs.js:85:26)
at Object.cljs$core$load_file [as load_file] (/Users/pupeno/Projects/ninjatools/target/server-side/cljs/core.js:305:13)
at Object.<anonymous> (/Users/pupeno/Projects/ninjatools/target/server-side/reagent/core.js:8:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
I wonder if it wouldn’t be possible and simpler to tweak a NODE_PATH environment variable or similar, to just add the target folder cljs builds to to the path node will use
Hi! Anyone familiar with secretary? I’ve got a few routes:
(defroute "/workspaces" []
(dispatch [:set-active-panel :workspaces-panel]))
(defroute "/workspaces/:workspace" [workspace]
(dispatch [:set-workspace workspace])
(dispatch [:set-active-panel :projects-panel]))
(defroute "workspaces/:workspace/:project" [workspace project]
(dispatch [:set-workspace workspace])
(dispatch [:set-project project])
(dispatch [:set-active-panel :project-panel]))
whereas the first two works fine, but the last one is not reacting at all. Any ideas?Does anybody know why input won’t change itself if I remove fn [] ?
(defn new-contact []
(let [val (r/atom "")]
(fn []
[:div
[:input {:type "text"
:placeholder "Contact Name"
:value @val
:on-change #(reset! val (-> % .-target .-value))}]
[:button {:on-click #(when-let [c (parse-contact @val)]
(add-contact! c)
(reset! val ""))}
"Add"]])))
I have a newbie type question about Om and how to use buttons to cause another sibling view to switch out. I was thinking I could use shared state but that seems global to the app. Is there a way to put the state in the containing component and then still get to it without passing it in all over? The page looks like:
navbar across top, then buttons down side in there own div section the is 1/4 of grid, then another div for middle and right of screen. When a button is clicked on left, I want to set state and then react to that and switch out middle
@vorob I think calling new-contact should be assumed to return function - I think result of call (new-contact) should be function composed with other functions to build DOM dynamically at the end... when you return this vector html structure just as it is the outer scope (where the atom is) will be not accessible as it is then only like lexical scope in new-contact function, but when You return function (which is using atom in function body) you are taking with You this outer scope ( atom ) because function needs to depend on it.
@vorob https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-2--a-function-returning-a-function
@vorob: An explanation of this issue is contained in the following repo https://github.com/reagent-project/reagent-cookbook/tree/master/basics/component-level-state
@scriptor writing and reading immediately from a cursor isn’t an encouraged thing. (get-in @root …)
might work.
@mbertheau: Om provides zero sugar for markup generation, you can sugar to taste. Also it’s very opinionated about modeling the application around a single atom.
@scriptor: @mbertheau: there’s also a decently active #C06DT2YSY channel here
Hi all! Have anyone tried to chunk 'defmethods' for 'defmulti' in different namespaces? I've tried require :refer form, without success. Or is it considered a bad practice for some reason?
@wambat: are you trying to create multimethod implementations for a multimethod defined in another namespace? That should work fine
(ns example.ns1)
(defmulti handle-ws-event first)
(ns example.ns2
(:require [example.ns1 :as ns1])
(defmethod ns1/handle-ws-event :error-event
[params]
(println params))
Nice tip, i'll try it. Thanks, @danielcompton