This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-09
Channels
- # admin-announcements (3)
- # beginners (60)
- # boot (95)
- # braid-chat (2)
- # cider (12)
- # clara (1)
- # cljsrn (30)
- # clojars (2)
- # clojure (58)
- # clojure-art (1)
- # clojure-austin (3)
- # clojure-madison (11)
- # clojure-miami (6)
- # clojure-norway (3)
- # clojure-poland (13)
- # clojure-russia (67)
- # clojurescript (108)
- # core-matrix (39)
- # cursive (15)
- # data-science (6)
- # datomic (3)
- # hoplon (7)
- # jobs (9)
- # jobs-discuss (40)
- # ldnclj (5)
- # off-topic (6)
- # om (91)
- # proton (9)
- # re-frame (29)
- # reagent (7)
- # spacemacs (3)
- # testing (9)
- # yada (1)
Does this look like a valid cljsjs code using jquery. I get returned an object, but the html page Im trying to embed wont show up in the targeted div. (js/jQuery (fn [] (.load (js/jQuery "main-content") (js/jQuery "about_en.html"))))
(defn load-main-content [page-url]
(-> (js/jQuery "#main-content")
(.load page-url)))
(js/jQuery #(load-main-content "about_en.html"))
BINGO!!! Wow, I've been spending last 2 hours trying to find cleaver way to use handlebarish partials without using mustache and iframe.
If someone haas time, would be nice to include more examples of jquery and cljsjs or in general documentation. Thanks so much for this.
I would have thougt so, I was trying to interop the javascript I already knew to write.
ok, but I was getting carried in google closure documentation, you know of any function that does the same as jquery load in google closure?
(defn load-main-content [page-url]
(let [container (js/document.getElementById "main-content")]
(xhr/send page-url
(fn [content]
(set! (.-innerHTML container) content)
))))
(load-main-content "about_en.html")
what is missing is the "onload" event handler since "onload" is sort of an anti pattern in closure
ok Im getting app.cljs:209 Uncaught TypeError: Cannot set property 'innerHTML' of null
well, thanks for this, I think I could hack this, didnt think about xhr, forgot that Im not doing cross domain so it should run without problems.
hi guys how to cons a map to a vector of map ? I have tried cons and concat, but it doesn't work as expected
(def ttt
[{:label "Total", :price 900}]
)
(cons ttt {:a :b})
;; expected result
;; [{:label "Total", :price 900} {:a :b}]
but the point is it seems to update the first map, what I want is another map in the vector instead.
Is anyone aware of a clojurescript reveal.js alternative?
but I need one to store a lot of s-expressions in. I'll be checking whether or not sexp are already present with in it, filtering them based on predicates and randomly selecting from these.
Is there a way to extend ring middleware declaratively to add new types to all encoders?
Aside from recursively going through and converting something like the response to base clojure types?
I have a deep stack trace where authorization is calling middleware.format_response which is then throwing due to something that is actually easily converted to a persistent vector.
specifically the main ad on the homepage “ClojureScript and Om"
@theqabalist: Thanks
@urbanslug: You might have better luck in the #C06DT2YSY channel
Has anyone seen cljsbuild silently fail on error and copy a cached version of cljs/js to destination before?
@urbanslug start with #C09GR9UJC? it’s like a gateway drug
How should I get the current route in cljs? I could use js/location.pathname
but is there a better way? Using the google closure lib perhaps?
@currentoor: that’s fine if that’s a cross browser way - I don’t know myself
cool thanks!
Someone people on my team are about to use react for a small project and got excited about the immutability stuff. I decided now was the time to drop the clojure bomb. They've now seen the talk @dnolen gave in reference to the Dream Machine, the Figwheel demo, Simple made easy, etc. Any other must see talks to keep the fire going?
Basically hitting a url: http://app/users/1 -> render that page with the html
Right now our app works by renderings a single page on the server for every url, so /users, /users/123 and / are all identical. In order for the page to catch up Angular knows the routes and renders the proper pages by loading the controllers for those routes. This is problematic for Google SEO, so in that case we render a full page with phantom js.
https://strongloop.com/strongblog/node-js-react-isomorphic-javascript-why-it-matters/
What would be a good way to watch over a height of div element like this (.-height (style/getSize (gdom/getElement "main-content"))) so that when it changes it will update the app-state? Because in om componentDidMount doesn't seem to catch the changes on the first page load, despite the main content will spit out html into the div inside the render part of the defui
@hlolli: from a quick search on SO there doesn't seem to be any easy way
I would watch window resize events and register subscriptions to see how it impacts the div's height
or just use setInterval
, but that seems unclean
Yes, I already have events on window resize, so I load the page, and the svg's Im trying to resize start incorrect, as soon as I resize the browser, they jump into right position.
I see that om has a clock counter when I transact, I could just tap into that and check for resizes for the first say 20 seconds and stop it after that (given that you are not using g3 signal on the antartica).
Maybe this clock won't start until the browser had fully rendered, then it wont be a problem anywhere?
a hack might work best here
I assume you're using a throttled or debounced function for the window resize?
Just call that function every few 100ms when the page loads
and make it so that "extra" calls of that function are safe if there is nothing to change
similar idea used here: https://github.com/oakmac/atom-parinfer/blob/master/src-cljs/atom_parinfer/core.cljs#L443-L451
ugly hack; works great
ok nice, yes, sometimes we need ugly hacks to solve things. I'm just surprised why componentDidMount is actually being called when in fact the component was not fully mounted.
glad to help
Any vi users having problems with cljs.build.api/watch
? It seems to trigger double recompile when saving due to the .swp
files
@bensu: set noswapfile
@juhoteperi: have you encountered that problem with watch
?
No, because I have always used noswapfile
It is not realistic for tools to ignore all strange temp files editors might create so best solution is to configure editors to not write temp files
Option to set ignore pattern could still be okay, but I prefer configuring the editor once instead of configuring multiple tools
@bensu @juhoteperi in shadow-build we fixed this by ignoring hidden files, that at least worked for emacs tmp files. should work for vim stuff as well. should be a simple patch for cljs.