[ClojureScript] Re: Question: Om, multimethod and local state
Looks like Om 0.7.0 solves this issue already, so we don't have to return functions instead or use condp anymore. On Wednesday, July 23, 2014 5:04:17 PM UTC+10, Adam Comella wrote: Instead of having the multimethods return components, you could have them return functions which return components. That way you pass different functions to build for different types. Like this: (defmulti get-entry-view (fn [person] (:type person))) (defmethod get-entry-view :student [person] student-view) (defmethod get-entry-view :professor [person] professor-view) And then use it like this: (om/build (get-entry-view (om/value person)) person) On Monday, July 21, 2014 12:33:42 AM UTC-7, feng zhou wrote: On Friday, July 18, 2014 2:02:54 AM UTC+10, Jarppe Länsiö wrote: I have this same problem. I thought multimethods would be great way to render different views in simple page app, so I wrote something like this: (def app-state {:view :login}) (defmulti render-view (fn [app owner] (:view app))) (defmethod render-view :login [app owner] (om/component ... (defmethod render-view :foo [app owner] (om/component ... (om/root render-view app-state {:target (js/document.getElementById app)}) This works, except that the local state does not work. I guess this is same problem Feng describes? What would be a work around? Shoud I just have a something like this: (om/root (fn [app owner] (condp = (:view app) :login (login-view app) ...one line for each view.. Using conditionals seems to be the easiest way to avoid state problems in multimethod. My guess is, multimethod should be avoided if a component has local state. Om's tutorial only used multimethods for components that do not have local state, just that it doesn't discuss potential issues and limitations of multimethod. With the limitation on mount/unmount that Daniel pointed out, I think it's easiest to not use multimethods. -- 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.
[ClojureScript] Re: [ANN] Longshi a ClojureScript port of Fressian
Cool stuff Peter. It would be interesting to compare performance with transit-cljs https://github.com/cognitect/transit-cljs. Transit has the same caching and extensibility benefits of Fressian but leverages the very fast JavaScript parser capabilities built into the browser, so is likely faster. Alex On Friday, August 1, 2014 3:33:58 PM UTC-5, pe...@bendyworks.com wrote: I'm happy to announce a port of Fressian to ClojureScript. The public api mirrors data.fressian api with a few exceptions. Records don't have a generic writer but you can easily append the handlers with the write-record function. There is no inheritance lookup for types so every different type will need it's own handler. The tagged helper functions (tagged-object?, tag, tagged-value) are not included. I see the use case for Fressian in ClojureScript streaming large amounts of data that has significant structural similarity. Fressian caching capabilities allow large values to be represented as a single integer in the bytestream. This is my first large ClojureScript library so any suggestions for improvements are welcome. Thanks to Bendyworks for letting me develop this during my work hours. Clojars Link: https://clojars.org/longshi Repo: https://github.com/spinningtopsofdoom/longshi Peter Schuck -- 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.
[ClojureScript] Re: ANN: ClojureScript 0.0-2280
As always, thanks for your hard work. -- 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] Re: [ANN] Longshi a ClojureScript port of Fressian
I thought transit's caching only applied to map keys? Pretty unclear on what Fressian's can do On Sat, Aug 2, 2014 at 8:23 AM, Alex Miller a...@puredanger.com wrote: Cool stuff Peter. It would be interesting to compare performance with transit-cljs https://github.com/cognitect/transit-cljs. Transit has the same caching and extensibility benefits of Fressian but leverages the very fast JavaScript parser capabilities built into the browser, so is likely faster. Alex On Friday, August 1, 2014 3:33:58 PM UTC-5, pe...@bendyworks.com wrote: I'm happy to announce a port of Fressian to ClojureScript. The public api mirrors data.fressian api with a few exceptions. Records don't have a generic writer but you can easily append the handlers with the write-record function. There is no inheritance lookup for types so every different type will need it's own handler. The tagged helper functions (tagged-object?, tag, tagged-value) are not included. I see the use case for Fressian in ClojureScript streaming large amounts of data that has significant structural similarity. Fressian caching capabilities allow large values to be represented as a single integer in the bytestream. This is my first large ClojureScript library so any suggestions for improvements are welcome. Thanks to Bendyworks for letting me develop this during my work hours. Clojars Link: https://clojars.org/longshi Repo: https://github.com/spinningtopsofdoom/longshi Peter Schuck -- 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] Re: [ANN] Longshi a ClojureScript port of Fressian
In Transit, maps keys, symbols, keywords, and tagged value tags are subject to caching. Fressian's caching strategy is far more flexible from what I understand. That said transit-cljs is 20-30X faster than cljs.reader/read-string on the benchmarks I've tried across various browser and command line JS environments. David On Sat, Aug 2, 2014 at 2:26 PM, Sean Grove s...@bushi.do wrote: I thought transit's caching only applied to map keys? Pretty unclear on what Fressian's can do On Sat, Aug 2, 2014 at 8:23 AM, Alex Miller a...@puredanger.com wrote: Cool stuff Peter. It would be interesting to compare performance with transit-cljs https://github.com/cognitect/transit-cljs. Transit has the same caching and extensibility benefits of Fressian but leverages the very fast JavaScript parser capabilities built into the browser, so is likely faster. Alex On Friday, August 1, 2014 3:33:58 PM UTC-5, pe...@bendyworks.com wrote: I'm happy to announce a port of Fressian to ClojureScript. The public api mirrors data.fressian api with a few exceptions. Records don't have a generic writer but you can easily append the handlers with the write-record function. There is no inheritance lookup for types so every different type will need it's own handler. The tagged helper functions (tagged-object?, tag, tagged-value) are not included. I see the use case for Fressian in ClojureScript streaming large amounts of data that has significant structural similarity. Fressian caching capabilities allow large values to be represented as a single integer in the bytestream. This is my first large ClojureScript library so any suggestions for improvements are welcome. Thanks to Bendyworks for letting me develop this during my work hours. Clojars Link: https://clojars.org/longshi Repo: https://github.com/spinningtopsofdoom/longshi Peter Schuck -- 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.
[ClojureScript] Dependent picklists using Reagent
I have three select components (picklists) which are dependent. The first determines the values of the second, and so on to the third. I'm able to get the first pair working, but the second pair has been tricky. Has anyone implemented something similar? -- 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] Re: [ANN] Longshi a ClojureScript port of Fressian
I took significant structural similarity to primarily mean at least maps with similar keys, which Transit caching will cover. On Sat, Aug 2, 2014 at 1:49 PM, David Nolen dnolen.li...@gmail.com wrote: In Transit, maps keys, symbols, keywords, and tagged value tags are subject to caching. Fressian's caching strategy is far more flexible from what I understand. That said transit-cljs is 20-30X faster than cljs.reader/read-string on the benchmarks I've tried across various browser and command line JS environments. David On Sat, Aug 2, 2014 at 2:26 PM, Sean Grove s...@bushi.do wrote: I thought transit's caching only applied to map keys? Pretty unclear on what Fressian's can do On Sat, Aug 2, 2014 at 8:23 AM, Alex Miller a...@puredanger.com wrote: Cool stuff Peter. It would be interesting to compare performance with transit-cljs https://github.com/cognitect/transit-cljs. Transit has the same caching and extensibility benefits of Fressian but leverages the very fast JavaScript parser capabilities built into the browser, so is likely faster. Alex On Friday, August 1, 2014 3:33:58 PM UTC-5, pe...@bendyworks.com wrote: I'm happy to announce a port of Fressian to ClojureScript. The public api mirrors data.fressian api with a few exceptions. Records don't have a generic writer but you can easily append the handlers with the write-record function. There is no inheritance lookup for types so every different type will need it's own handler. The tagged helper functions (tagged-object?, tag, tagged-value) are not included. I see the use case for Fressian in ClojureScript streaming large amounts of data that has significant structural similarity. Fressian caching capabilities allow large values to be represented as a single integer in the bytestream. This is my first large ClojureScript library so any suggestions for improvements are welcome. Thanks to Bendyworks for letting me develop this during my work hours. Clojars Link: https://clojars.org/longshi Repo: https://github.com/spinningtopsofdoom/longshi Peter Schuck -- 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 a topic in the Google Groups ClojureScript group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/xhdrGunEXPE/unsubscribe. To unsubscribe from this group and all its topics, 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.
[ClojureScript] [ANN] Om Server Rendering Example
I was really excited to see [Dom Kiva-Meyer](https://github.com/DomKM)'s article on [Isomorphic Clojure[script]](http://domkm.com/posts/2014-06-15-isomorphic-clojure-1/) and the accompanying example project [Omelette](https://github.com/DomKM/omelette). His server rendering implementation is very elegant, and his thinking about routing as bidirectional pure functions between state and uri closely mirror my thinking with [Tao](https://github.com/pleasetrythisathome/tao). However, I wanted a minimal test case for server rendering as a way to wrap my head around exactly what's happening for future use, so here it is! [Om Server Rendering Example Project](https://github.com/pleasetrythisathome/om-server-rendering) The one limitation I found is that the [weasel](https://github.com/tomjakubowski/weasel/) repl of which I've grown so fond is incompatible with Nashorn. clojure.browser.events extends js/Element which is undefined in Nashorn. I've found some suggestion that this is also true in ie8 and below, but haven't tested. I logged the issue [here](https://github.com/tomjakubowski/weasel/issues/20). If anyone else is inspired to port weasel to [goog.clojure](http://docs.closure-library.googlecode.com/git/class_goog_net_WebSocket.html), let me know and maybe we can collaborate, I don't think it's a huge lift, but I'm not terribly familiar with repl implementations... The project also currently using :optimizations :whitespace to merge all output code into a single file to simplify Nashorn evaluation. Dom does the same thing in Omelette, but I'm sure you could add additional eval statements in order to use :whitespace :none for faster development, which is especially needed without a repl (I know Austin works, but I've had so many frustrating days with it, I've given up). Additional, although wrap-reload reloads the server on file save, the compiled js file is read on compile when the routes are defined, which means that you have to redefine the routes to pick up changes for server rendering. Definitely not an ideal development environment...fixes and/or ideas to streamline the process are welcome. -- 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.