This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-27
Channels
- # beginners (43)
- # boot (1)
- # cider (7)
- # cljdoc (10)
- # clojure (110)
- # clojure-boston (1)
- # clojure-finland (2)
- # clojure-italy (19)
- # clojure-losangeles (1)
- # clojure-new-zealand (1)
- # clojure-nl (4)
- # clojure-spec (34)
- # clojure-uk (163)
- # clojurescript (136)
- # code-reviews (1)
- # component (13)
- # cursive (18)
- # datomic (99)
- # emacs (14)
- # events (4)
- # fulcro (14)
- # hoplon (15)
- # hyperfiddle (3)
- # jobs (3)
- # jobs-discuss (1)
- # lein-figwheel (10)
- # onyx (1)
- # pedestal (8)
- # re-frame (5)
- # reitit (4)
- # rum (1)
- # shadow-cljs (317)
- # spacemacs (24)
- # specter (9)
- # sql (2)
- # tools-deps (6)
- # yada (3)
There we go. New version up here: https://johnmn3.github.io/tau.alpha/ Has a more convenient floating FPS counter too.
This might be a silly question, but I need to use a js library that assumes you have a react/redux application. It provides a react component and a redux reducer. Is there a reasonable way to integrate such a library? Can redux be run with cljs?
@mv you can do that, but you’d have to write something to bridge from redux to whatever cljs react wrapper you are using
it may just work to have the redux machinery working alongside the reagent/reframe machinery. the devil is in the details: how are you supposed to interact with it. i’ve never seen a library that assumes a redux store
If you are interested: https://github.com/uber/kepler.gl
from a brief glance, it looks like it just minds its own business in its own key, so that would indicate that you could just run redux alongside whatever you are doing in cljs. i think that would work, because redux will just send new props to the kepler stuff whenever things update and something like reagent will be fine with that
Hey,
maybe someone can give me a helping hand with this.
I am trying to change the currentTime of a video. The ref to the video is saved in an atom and I have no idea how to change the property in that. Does someone have an idea?
The code looks like this:
(defn video []
(let [!video (r/atom nil)]
[:div.video-container
[:video {:ref (fn [el] !video el)}
[:source {:src "foobar.mp4" :type "video/mp4"}]]
[:button {:on-click (fn []
(when-let [video @!video]
(set! (.-currentTime video) 5)))}]]))
@duerrhauer this (fn [el] !video el)
does basically nothing. you probably want (fn [el] (reset! !video el))
sry, missed that in the code block
@thheller, do you see another error? I still can not change the currentTime
this works without a problem
[:button {:on-click (fn []
(when-let [video @!video]
(if (.-paused video)
(.play video)
(.pause video))))} "play"]
so it should have the right reference
Do I need to do something with reset! or swap!?
when in doubt add a prn
or js/console.log
just before the set!
to check if its actually getting called
thank you. I've put a if clause in it that wasn't correct.
solved the problem
I wasn't sure how to use an atom with an element reference, thanks for making that clear!
What is you preference and why?
(aget w3 "eth" "accounts")
; vs
(.. w3 -eth -accounts)
or ..
. never aget
since you are not working with an array. or rather eth
is not an array. accounts
might be.
aget
is for arrays-only and should only be used with numeric indexes. see https://clojurescript.org/news/2017-07-14-checked-array-access
thats why I added the (do-something-with-account)
the ..
only allows to access object properties/methods. ->
is more flexible.
but ..
is totally fine if you just want something short and don't need that flexibility
ok thx, it is pros and cons in the same time. ..
can make very clear this part is about get data. But I don’t have strong opinion at that moment.
Has anybody ran into this error when trying to run figwheel or figwheel-main:
CompilerException java.lang.ClassNotFoundException: expound.ansi, compiling:(figwheel/main.cljc:174:5)
@aaronmmartz sounds like a classpath problem
one way to fix this is to add expound 0.7.0 as a dependency wherever you are placing the figwheel-main dep
Unhandled java.lang.Exception
Failed to launch Figwheel CLJS REPL: nREPL connection found but unable to
load piggieback. Please install
https://rigsomelight.com/figwheel-main/docs/installation.html#dependencies-with-leiningen
Running figwheel-main brings up:
File dev.cljs.edn does not exist
#:cljs.main{:error :invalid-arg}
Ok thanks for the help. I'll put aside the piggieback error for figwheel and go through the full set-up process for figwheel-main
take a look at the docs https://rigsomelight.com/figwheel-main/docs/installation.html
I'm fairly new to all of this, so take that as a grain of salt with what I'm about to post
With most of the clojure tools and libraries, I've run into the problem of not enough documentation
With figwheel, figwheel-main and cider, it is almost too much documentation, especially since there have been some big changes in dependencies (or so it seems to me)
Is there a way to import a class but name it something else? i.e. I want to add (goog.ui Tooltip)
to my :import
s but I'd also like a function named Tooltip in my namespace.
@kenny you could just import the full thing [goog.ui.Tooltip] and then (def GTooltip goog.ui.Tooltip)
Yeah, just changed my :import
from (goog.ui Tooltip)
to (goog.ui.Tooltip)
and it did not work.
It works for me (in Planck). Evaluate goog.ui
to see what you get
cljs.user=> goog.ui
#js {:PopupBase #object[Function],
:Popup #object[Function],
:Tooltip #object[Function]}
@kenny (:import (goog.ui.Tooltip))
is not valid. either (:import goog.ui.Tooltip)
or (:import (goog.ui Tooltip))
I’m fairly confident I tried that too and it still caused issues. Will be offline for a bit so won’t be able to try that out.
(:require [goog.ui.Tooltip])
should to it though since that doesn't create the Tooltip
local
Does anyone know of a good library for doing syntax highlighting of clojure code with hiccup? I am trying to view clojure formatted code in my webpage
@jacob.haag I normally use more standard solutions
@jacob.haag you can use highlight
you can find highlight on http://cljsjs.github.io
@jacob.haag @bhauman I made an online markdown editor. https://coolmarkdowneditor.org/ I'm pretty new to clojurescript and frontend development so any feedback is welcome 🙂
Source code is: https://github.com/dawran6/markdown-editor