[ClojureScript] What is clojurescript 1.9.495?
When running lein ancient on a clojurescript project, it suggests there is a version 1.9.495, but the clojurescript github page states that 1.9.494 is the latest released clojurescript version. Where does clojurescript 1.9.495 come from, really? Thanks, Linus -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] ClojureScript Dropdown Menu
Hi Rickesh, it looks like you use reagent. I think the type-ahead functionality in reagent-forms is the simplest way to get that functionality. https://github.com/reagent-project/reagent-forms#typeahead /Linus 2017-03-15 11:31 GMT+01:00 'Rickesh Bedia' via ClojureScript < clojurescript@googlegroups.com>: > I have a html page that contains a navigation bar at the top of the > screen. In the navigation bar, I have a search box and what I want it to do > is, you type in this box, hit enter and the results are displayed as a > dropdown menu > > > > This is the html search input box. I have given it an id `search-bar` to > eventually create the dropdown menu in ClojureScript > > (when-let [section (. js/document (getElementById "search-bar"))] > (r/render-component [search-bar-component] section)) > > Currently I have a search-form that looks like the following > > (defn search-form > [] > [:div >[:p "What are you searching for? " > [:input > {:type :text > :name :search > :on-change #(do > (swap! fields assoc :search (-> % .-target > .-value)) > (search-index (:search @fields))) > :value (:search @fields)}]] >[:p (create-links @search-results)]]) > > (defn- search-component > [] > [search-form]) > > This is my `search-component`. > > What I want to happen is when you type in the input box on the navbar (say > "hello", it calls `search-index` from the search-form with the parameter > being the value you type in ("hello") and then returns the results as a > dropdown menu below. > > `search-form` works right now as a form on a html page, where you input > some text into a form and then the results are displayed below. I want to > change it to be on the navbar instead of as a separate page, where the > input form is on the navbar and the results are displayed below > > How would I have to change my search-form in order to do this? > > I think I can do something along the lines of this > > (defn search-bar-form > [] > [:div >[:input > {:type :text > :name :search > :on-change #(do >(swap! fields assoc :search (-> % .-target > .-value)) >(search-index (:search @fields))) > :value (:search @fields)}] >[:p (create-links @search-results)]]) > > (defn- search-bar-component >[] >[search-form]) > > Any help would be much appreciated. > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] Adding schema.org microdata using hiccup
it's like... not possible with hiccup. Usually I do [:div {:itemscope true} "BRMC"] or perhaps [:div {:itemscope :itemscope} "BRMC"]. I hope that works out in this case as well. /Linus 2017-02-21 21:33 GMT+01:00 Divyansh Prakash: > Hi! > > I'm working on a music discovery website (http://www.rockhuntrs.com). > It's built on top of reagent-template. > > I now want to add schema.org microdata that looks like this: > > > BRMC > > > How do I add the itemscope attribute? > > [:div {:itemscope ??} "BRMC"] > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
[ClojureScript] Refactoring for ClojureScript?
Is it possible to run something like cljr clean ns [1] on ClojureScript source code? /Linus [1] https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-clean-ns -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] How to Integrate Third Party Libraries
There are cookbooks for both Om and Reagent: https://github.com/omcljs/om-cookbook https://github.com/reagent-project/reagent-cookbook They're really helpful, both for Om and Reagent respectively, but also for getting a better understanding och js-interop in general. /Linus 2016-07-06 21:58 GMT+02:00 Brandeis King: > Hi, > > I recently started playing with ClojureScript, but I do have prior > experience with Clojure and JavaScript (including React, Flux, Webpack, > etc.). While I've been able to pick up the basics fairly easily and put > together toy apps using Reagent and Om, I'm unclear on how to integrate > third party libraries like Bootstrap, d3, etc. I'd appreciate suggestions > on how I could/should integrate these libraries into ClojureScript apps. > Thanks. > > Best, > Brandeis > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] Re: svg element disappears when figwheel icon disappears
Are you aware of that reagent make react have the DOM under quite tight control by default? Have you made wrapped your graph along the lines of https://github.com/reagent-project/reagent-cookbook/blob/master/recipes/highcharts/README.md ie that React should leave the node with subnodes untouched (and let d3 or similar take care of the updating there) /Linus Den 4 juli 2016 19:59 skrev "mars0i": This behavior seems to have to do with Reagent; it goes away when I get rid of Reagent and use an HTML file instead. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] Mocking Javascript method for test
I think you could just use (aset the-object "methodName" (fn [] ...)). I don't know how javascript handles "this" in such a case, hopefully you can do without it. There are plenty of examples of interacting with js objects in ClojureScript here: http://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/ /Linus How to mock a Javascript method during test? I tried '(with-redefs [js/object.methodName (fn [] ...)] ...)'. Doing so I get following error: Caused by: clojure.lang.ExceptionInfo: Invalid local name: object.methodName ... -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] Reagent and Semantic-UI
You have to make sure React doesn't touch the elements after Modal dialog codes it job. Use the similar technique as is shown in the highcharts cookbook entry: https://github.com/reagent-project/reagent-cookbook/blob/master/recipes/highcharts/README.md (You may consider if it's a good idea to have other tools ready to rebuild the DOM, instead of generating the nescessary codw through reagent directly, but it's doable, and sometimes a good way forward). /Linus Den 6 apr. 2016 05:56 skrev "Fernando Abrao": > Hello All, > > I´m trying to use Reagent with Sematic-UI Modal but I´m getting error in > dialog button event. Code below. > > The open dialog is ok, but When I click to button "OK - Fechar" it´s > getting the error: > "Uncaught Error: Invariant Violation: findComponentRoot(..., .6.0.0.2.0): > Unable to find element. This probably means the DOM was unexpectedly > mutated (e.g., by the browser), usually due to forgetting a when > using tables, nesting tags like , , or , or using non-SVG > elements in an parent. Try inspecting the child nodes of the element > with React ID ``." > What I´ve missing? > > > (def jquery (js* "$")) > > (defn mostra-dialogo [id] > (let [dialogo (jquery id)] > (.modal dialogo "show"))) > > (defn esconde-dialogo [id] > (let [dialogo (jquery id)] > (.modal dialogo "hide"))) > > (defn dialogo [] > [:div {:class "ui united small modal" :id "dialogo"} >[:div {:class "header"} "MODAL"] >[:div {:class "content"} "AHAHAHAHHA"] >[:div {:class "actions"} > [:button {:class "ui blue labeled button" :id "btSair" > :on-click (fn [e] (js/console.log "NO !!!"))} "OK - Fechar"] >]]) > > (defn home-page [] > [:div >[dialogo] >[:div {:class "ui primary button" :id "btAbrir" > :on-click (fn [e] (mostra-dialogo "#dialogo"))} "Modal"]]) > > (defn current-page [] > [:div [(session/get :current-page)]]) > > ;; - > ;; Routes > > (secretary/defroute "/" [] > (session/put! :current-page #'home-page)) > > ;; - > ;; Initialize app > > (defn mount-root [] > (reagent/render [current-page] (.getElementById js/document "app"))) > > (defn init! [] > (accountant/configure-navigation! > {:nav-handler > (fn [path] >(secretary/dispatch! path)) > :path-exists? > (fn [path] >(secretary/locate-route path))}) > (accountant/dispatch-current!) > (mount-root)) > > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] Om.Next: Component structure limitations
datomics pull-api actually goes both ways with reverse-lookup [1] by using reverse lookups you could have the dashboard query look something like [{:dashboard/items [:item :name {:_cart [:id]}] (minus om/get-query things). Such a data-structure would make highlighting easy, just look if the attribute :_cart is non-nil. {:books [{:item 1 :name "Joy of Clojure" :_cart {:id "cart-id-1"} {:item 2 :name "Domain driven design"} {:item 3 :name "Thinking fast and slow"}]} I don't know exactly how to do this in om-next, but in Datomic this works quite well. [1] http://docs.datomic.com/pull.html#reverse-lookup /Linus 2016-03-29 13:29 GMT+02:00 Serzh Nechyporchuk: > Hi to everyone, > > I'm am very excited about the new version of Om. It really moves front-end > developing to the new level, so you can deal with much bigger complexity. > > But I have one concern about it, that I can't resolve by myself. > David talks all the time that client must have an ability to ask data and > shape of that data from the server. So you have one API endpoint with > datomic-pull like API to work this problem out. With this approach > hierarchy of your components must always follow the hierarchy in your data. > You can't change the "shape", you only can change keys you want in > resulting map. Data flows only from top to the bottom and not in any other > way. For example > > I have app data looks like this: > > {:books [{:item 1 :name "Joy of Clojure"} >{:item 2 :name "Domain driven design"} >{:item 3 :name "Thinking fast and slow"}] > :cart [{:item 1 :name "Joy of Clojure"}]} > > > And I have components: > > (defui Item > static om/Ident > (ident [this {:keys [id]}] >[:item/by-id id]) > static om/IQuery > (query [this] >[:id :name])) > > (defui Dashboard > static om/IQuery > (query [this] >`[{:dasboard/items ~(om/get-query Item)}])) > > (defui Cart > static om/IQuery > (query [this] >[{:cart/items ~(om/get-query Item)}])) > > (defui RootView > static om/IQuery > (query [this] >`[{:dashboard ~(om/get-query Dashboard)} > {:cart ~(om/get-query Cart)}])) > > > so I have Cart and Dashboard reuse same Item component. > > The task is to add Item to the Cart from Dashboard on click and highlight > it as added. There are no problems with adding, but there is one problem > with highlighting. So, there are two options: > * just add flag to the Item that it is added > * look at the cart/items when rendering items to see if it is added > The first option adds some redundancy to the data, so the second is more > preferable. For second option Item component should have :dashboard map as > prop. > > So the whole problem that I can’t figure out how to do this, how to > describe this in a query. So this, datomic-like, API allows you to create > element hierarchy that can only follow the hierarchy in the data. > > Thank you. > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] interop to ChartJs (newbie level)
Either you can checkout Quil in clojurescript, which is wrapping Processing for js. It's a well designed and mostly imperative-style graphical environment. https://github.com/quil/quil/wiki/ClojureScript You can, of course, use the ordinary js methods to create and paint on a canvas element like these: http://stackoverflow.com/questions/8330956/can-the-html5-canvas-element-be-created-from-the-canvas-constructor Given that you write [:canvas ... ] in your question, maybe you want to use a templating library that uses the hiccup-styled vector-html-syntax, like Hipo [3]. (ClojureScript doesn't interpret [:p "hello"] as a p-tag by itself, but it's a good datastructure to generate html-source, dom-nodes or even react components from. [3] https://github.com/jeluard/hipo/ There's also a clojurescript library called Monet which seems to be designed for painting canvases: [4] https://github.com/rm-hull/monet React? As you probably know, React takes a different approach to dom manipulation which makes me recommend you to avoid trying to paint canvases with it for now. Not that it wouldn't be possible - for instance Flipboard uses a react-based canvas renderer [5], but I would be very certain on both React, ClojureScript and Canvas manipulation before I would use it. Rumors claim that React was inspired by computer game graphics, which were conservative on which pixels it actually touched and something similar would indeed suit canvases very well, but I'm not wether there are any clojurescript libraries/attempts on this (although it's tempting!). [5] https://github.com/Flipboard/react-canvas /Linus 2016-03-11 19:42 GMT+01:00 Richard Keating: > ;; this works to draw in an existing canvas > ;; (def c (.getElementById js/document "myChart")) > ;; (def ctx (.getContext c "2d")) > ;; (def chart (new js/Chart ctx)) > ;; (.Radar chart (clj->js @app-state)) > > > > ;; but how do i create a new canvas and set the data > ;; that i want it to render > (defn hello-world [] > [:canvas >(fn [this] > (let [ctx (.getContext this "2d") chart (new js/Chart ctx)] >(.Radar chart (clj->js @app-state] > > ) > > ;; bonus: the chart some times requires a reload to adjust its > ;; configuration > > ;; thanks for your consideration and time > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
Re: [ClojureScript] Easiest way to compile cljs live
Figwheel is nice, even though I just get the repl in the command-line there (no autocomplete etc). The features for compiling and update client side cljs is really really good. https://github.com/bhauman/lein-figwheel Den 11 sep 2015 04:22 skrev "Mike Fikes": > 1. Are you setting :repl-options in project.clj? If so, I suspect that > only affects Lein’s Clojure REPL. See > https://github.com/clojure/clojurescript/wiki/Running-REPLs and, in > particular, :repl-verbose true would be provided in the map argument to > cljs.repl/repl*. > > 2. If you are running Planck on OS X, the `-v` option puts Planck into > verbose mode, showing compiled JavaScript. If on OS X but running a REPL > that ships with ClojureScript (like script/noderepljs) or a REPL that is > based on from ClojureScript’s cljs.repl, comment #1 above applies. > > On Sep 10, 2015, at 9:41 AM, Yehonathan Sharvit wrote: > > 1. I set :repl-options {:repl-verbose true} but the repl didn't show any > js > 2. I'm on mac but I can't see the compiled js on the repl > > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at http://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Use a specialized Clojure library in Clojurescript
This is a good question. Until very recently, there was no easy way to share code between Clojure and ClojureScript at all, although the pure clojure-core stuff did work pretty much out of the box. Still it's quite common that a library has dependencies to other jvm-stuff, or uses jvm-stuff under the hood. Or, the horror, calls external processes. If this is the case your out of luck/has to convert the jvm-specific things to something availiable in cljs/js. What libraries are you thinking of? /Linus 2015-09-09 0:09 GMT+02:00 Dan Campbell: > Is it always necessary to rewrite a Clojure library in Clojurescript, in > order to use its functions? > > There are several third-party Clojure libraries that I'd like to use in a web > page, but cannot find a way to call the Jar methods directly. > > > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Migrating from JSON to EDN
Transit is noticeably faster than EDN. I cannot recommend to use JSON between a clojure backend and a clojurescript application, it's just simply too much work to get everything right, entering dates, big decimals, UUIDs... /Linus 2015-09-04 18:37 GMT+02:00 Brandon Adams: > Last time I checked, EDN was slower than JSON browser-side. I don't have any > numbers on that, but it never affected the SPA I wrote and used EDN with. It > was nice being able to send tagged values and sets, which are both things > json doesn't have. > > Have you looked into Transit? It seems to offer a lot of the benefits of EDN > without taking much of a performance hit. It's also a little more portable > across other languages (although you said this doesn't matter right now). > > As far as switching, it's probably just middleware that needs swapping out > and your mimetype that needs to change in cljs-http or cljs-ajax. EDN works > as a superset of JSON using most of the common ring middleware. If you want > to begin taking advantage of EDN features, you won't have to worry about how > to map various record types or custom types into JSON anymore (although you > obviously have to have a tagged reader implementation registered in the > browser to do something with them). > > On Fri, Sep 4, 2015 at 10:28 AM, Jonathon McKitrick > wrote: >> >> I have a basic SPA app using JSON for client/server communication. I'm >> considering switching to EDN. >> >> * Is there any reason I should consider staying with JSON, assuming this >> API will not be consumed elsewhere? >> >> * How complex is the changeover on both client and server sides? >> >> * Are there any other caveats I might want to consider? >> >> -- >> Note that posts from new members are moderated - please be patient with >> your first post. >> --- >> You received this message because you are subscribed to the Google Groups >> "ClojureScript" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojurescript+unsubscr...@googlegroups.com. >> To post to this group, send email to clojurescript@googlegroups.com. >> Visit this group at http://groups.google.com/group/clojurescript. > > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Namespaces in ClojureScript that begin with clojure
I'm not sure if I understand your question, but there's no apparent way clojure.browser.dom would make any sense since it doesn't (or at least didn't) map to any specific JVM host language feature, but was very relevant in clojurescript, at least in the pre-react era. The stranger part is probably that some libraries are name for instance clojure.core.async and cljs.core.async for the different hosts. With the new conditional readers in 1.7.0 I think we could expect these libraries will harmonize the nameing to clojure.core... /Linus Just curious. There are several ClojureScript namespaces that begin with clojure that are available in both Clojure and ClojureScript, for example clojure.set and clojure.string. Then there are namespaces like clojure.browser.dom that do not have a corresponding namespace in Clojure. Why the difference? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Best practices when working with OOP oriented library
Well, if you know javascript well enough I don't think the interop is that much of a problem. There are some things which can be a bit unintuitive, but usually there are plenty of answered questions at StackOverflow and other places, or just ask here! I would recommend starting out with lein figwheel and the flappy-birds example (some interop examples there already) and see where you end up: https://github.com/bhauman/lein-figwheel /Linus 2015-08-10 16:21 GMT+02:00 Aleksandr aleksander.gulya...@gmail.com: Hi, I am working on an HTML5 game and eager to use clojurescript, however, the library I am planning to use heavily relies on OOP principles. Are there good examples on wrappers around existing javascript libraries? Thanks! -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] (newbie) Om/reagent (and react) clarity questions
One cool thing which solves one of the problems (namely get views out of the data) is DataScript [1]. There are some nice and quite compact examples [2] which are not that trivial (at least they have two different widgets). DataScript is encouraging in that it feels doable to get data out of the model without having to manually make clever but brittle structural assumptions on the inevitable evolving of the data schema. [1] https://github.com/tonsky/datascript [2] https://github.com/tonsky/datascript-chat /Linus 2014-10-23 15:32 GMT+02:00 Peter Jaros peter.a.ja...@gmail.com: A few thoughts, though I’m sure others will have more: - Om requires your entire React render tree’s data to be stored in a single atom, but you can have as many render trees as you’d like on a page, each with its own atom of state. It’s more common to just use one, but more than one is an option, if it makes sense for you. - In Om, state like showing and hiding a tab is sometimes stored in the application state, and sometimes stored in the component’s local state. That’s a matter of preference. As far as I know there’s no big rule of thumb for when one is better than the other; they each have some subtle advantages and disadvantages. - Reagent is more than just a thin veneer over React. It does quite a bit of work, just as Om does. This is subjective, but Reagent feels more easy than simple to me. Sometimes, that’s what you want; sometimes it’s not. But: I’ve barely touched Reagent myself, so take that with a large grain of salt. I’d love to hear a response from someone actually working with Reagent. - There *is* a React wrapper that’s mostly a thin veneer: Quiescent https://github.com/levand/quiescent. Quiescent, to me, is at the simple end of the simple-easy spectrum. Unlike Om or Reagent, it doesn’t manage your rendering for you; you store your state where you will and tell it to render the tree when you think it should (which is how React itself works). I have a blog post http://blog.peeja.com/blog/2014/10/01/react-four-ways-how-to-use-react-in-clojurescript/ that goes into some more detail with links to examples, if you’re curious. Hooking up URL routing to any of these has had my head spinning as well. I’d love to hear what other people are doing for that too. Peter On Thu, Oct 23, 2014 at 9:04 AM, Colin Yates colin.ya...@gmail.com wrote: (apologies if I have overlooked any of this in the docs, it isn't from lack of reading, more reaching saturation point - RTFM is a perfectly good response if it contains a link to the relevant bit :)) My use case is that I have a non-trivial single page app. Inside this app there are a number of distinct areas, for a completely made up domain of car rental: - searching for/editing/adding a new customer - searching for/editing/adding a car - assigning a car to a customer - receiving a car from a customer - removing a car due to maintenance/crash - various reports - top 10 customers, top 10 cars etc. - and so on Each functional area is pretty unrelated from the others. Inside each functional area there are individual components that all need to talk to each other. Is it true that om really wants to manage the entire application state in a single atom. So we might have an atom map structured with keys referencing each functional area {:car-search {} :patient-search {} ...}? I understand that this isn't inefficient as components receive a cursor into their bit of the map thus avoiding unnecessary false changes. The main app will have an expandable left panel containing the global menu. In dom-manipulation world I would add a collapsed or expanded CSS class which defined the appropriate widths etc. In om (or rather react) land this is still possible I think, but is it more idiomatic to store the expanded/collapsed flag in the application state thus causing the panel component to re-render, the panel component then switching on that expanded? flag? The central panel also needs to be resized in response to the expansion/collapse, thus both components need to be in-sync. How is this idiomatically handled? In the more general case, there are components that need to be shown/hidden (tabs, validation pop-up errors etc.). In dom-manipulation world I would set css classes to change style's visibility for example, is this idiomatically done through flags in the application state? I am stumped as to how routing navigation fits into something like om. Again, is it a case that the navigation handlers simply update the application state? (You can see a theme in my thinking here!) In terms of reagent is it true to say that it is a bit less opinionated about these things and where-as om has a very opinionated approach to front-end state management (happening to use om), reagent is a (very nice) wrapper to om? Not to trivialize
Re: [ClojureScript] Re: Om when updating mouse-position dependent Dom
Thanks for IDidUpdate! That works, but... It turns out I cannot easily get the coordinates of the mouse or the element where the mouse is. I solved my particular issue by using CSS :hover functionality instead. CSS seems to get events whenever the layout is changed and can keep track of the mouse pointer, and is a simpler solution overall. It's remarkable I cannot easily get the coordinates of the mouse whenever I like, If I'm not aiming for severe CSS-hacks, like binary searching of the screen with an absolute-positioned div looking for :hover-status or something. I don't want to go there just yet. Thanks, Linus 2014-06-22 21:00 GMT+02:00 Roger Gilliar roger.gill...@googlemail.com: You may use the defprotocol IDidUpdate (did-update [this prev-props prev-state])) function. This one is called when React has rendered the component into the DOM. This would allow you to get the mouse position and update the state. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.