Fork me on GitHub
#clojurescript
<
2016-03-17
>
timothypratley04:03:50

@smw Thank you! Glad to hear I am not alone simple_smile simple_smile

smw04:03:29

Great article! Thank you simple_smile

slotkenov12:03:04

Why would I get WARNING: no :cljsbuild entry found in project definition. when running lein cljsbuild while I have a :cljsbuild entry in my project, and it does its job?

pez14:03:58

I’m using pushState and need to keep track of the scroll position of any page in the navigation history. (So that I can restore the scroll position when the user navigates using history.back()and next(). Seems I can add custom state to the history object - http://loganlinn.com/blog/2014/05/26/push-state-and-clojurescript/ - but that makes my SPA to unload and reload from scratch. Not sure if that’s specific to how I have set up routing, but before I start to investigate that I’d thought I could ask you guys if you’ve had this problem? And of course, I’m super curious about how you maintain scroll position in these scenarios!

pandeiro15:03:41

I'm trying to synthesize the reasons why CLJS package management / build toolchain is preferable to existing JS tooling; if anyone has any input or links to technical discussions of the merits of e.g. maven vs npm, I'd appreciate it

urbanslug15:03:36

Hey, we don’t have >!! in cljs.core.async?

matthavener15:03:00

urbanslug: since javascript is inherently asynchronous, it couldn’t exist because you can’t block in javascript

matthavener15:03:32

vs in clojure, it blocks the thread until the data can be put into the channel

urbanslug15:03:33

Well I don’t know JS at least not much JS

urbanslug15:03:49

Can I just use >! instead?

matthavener15:03:05

yeah, use >! inside go blocks, or use put!

matthavener15:03:39

put! can be called outside a go block, but its possible to lose data if the channel isn’t ready for data

urbanslug15:03:42

matthavener: What I actually want is <!

matthavener15:03:07

you almost certainly want a go block then simple_smile

edbond19:03:49

cljs core match error "#object[TypeError TypeError: Cannot read property 'backtrack' of undefined]" in figwheel repl:

(require '[cljs.core.match :refer-macros [match]])

(let [x true
      y true
      z true]
  (match [x y z]
     [_ false true] 1
     [false true _ ] 2
     [_ _ false] 3
     [_ _ true] 4))

edbond19:03:16

why is this error happens?

flyboarder19:03:02

hey guys, im looking to transcribe the following js to cljs but I cant seem to figure it out, help would be appreciated!! $('html,body').animate({ scrollTop: element.offset().top }, 'slow');

dnolen19:03:32

@edbond: you need to load the runtime support not just the macros

dnolen19:03:05

@edbond: the README is wrong, fixing

dnolen19:03:01

@edbond: hrm actually the README seems right

dnolen19:03:16

not sure what’s wrong there - unless that's a REPL session or something

dnolen19:03:01

@edbond: what version of ClojureScript are you using?

dnolen19:03:10

I would make sure this is with 1.7.228

edbond19:03:21

[org.clojure/clojurescript "1.7.170"] [org.clojure/core.match "0.3.0-alpha4"]

edbond19:03:36

yes, the readme works

dnolen19:03:10

what REPL are you using?

edbond19:03:12

but the code I wrote don't. Will try new version

edbond19:03:28

yes, 228 works fine.

niwinz19:03:26

@flyboarder: (-> (js/$ "html,body") (.animate #js {:scrollElement (.-top (.offset element))} "slow")) can be a first approach maybe

edbond19:03:03

:scrollTop instead of :scrollElement

flyboarder19:03:37

@niwinz @edbond it doesnt seem to like (.offset element)

niwinz19:03:41

I only have translated your js to clj, I don't have much context for help more

niwinz19:03:54

is element is defined anywhere, maybe is that a problem

flyboarder19:03:11

fair enough, im basically just trying to implements a smooth scroll to the bottom when content expands

niwinz19:03:26

I suggest just not using jquery and start using google closure facilities or maybe some library that wraps it like https://github.com/plumatic/dommy

niwinz19:03:54

It there are also https://github.com/ibdknox/jayq jquery wrapper that makes jquery usage in cljs a little bit more idiomatic

flyboarder19:03:29

Yeah i tried jayq and couldnt really figure it out, im using hoplon right now

flyboarder19:03:37

dommy is interesting

chrisoakman19:03:31

assuming you have access to element in that scope

flyboarder19:03:51

@chrisoakman: thanks! looks like Hoplon already supports what I was looking for, it’s just not working how I expected 😛

nberger20:03:23

FWIW probably you want (.-offset element) instead of (.offset element)

nberger20:03:17

Oh shit, (.offset element) is fine... sorry for the noise