[ClojureScript] How do you retrieve the value of an item in a listbox, in Clojurescript?
Hi, I've been having some difficulty, locating documentation that explains how to get a listbox item value. There are loads of examples of how to obtain or set the value of a text area, or of a browse-style list. I think the problem is that, in the html, it's not actually called 'listbox', and therefore a Google search isn't producing optimal results. So if we have a listbox lst_01 as below, how would we obtain the second item ("Value_02")? Item_01 Item_02 Item_03 If we try to get the listbox object, by setting lst_01 to ( ef/from "#lst_01" ( ef/read-form-input ) ) , then the contents of lst_01 in Clojurescript, is just a unit set of the first (selected) value #{"Value_01"} Is there a way to obtain non-Selected values, anywhere in the listbox? Or a vector/list of all values? It's clear how to do this in Javascript, but I'd like to stick with Clojurescript idioms, preferably with Enfocus. But even a non-Enfocus example, would help. -- 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] Favorite Web Stacks and why
I’m curious what your favorite web stacks in Clojure and Clojurescript are these days. Client and server libs you like to use and what you like and don’t like about them. Cheers, Jamie -- 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] Issue: reify Object with vararg method
Hello, I guess I've stumbled upon a compilation error. The repo for reproducing is here: https://github.com/metametadata/cljs-reify-error TL;DR: (let [v 123 obj (clojure.core/reify Object (meth [this x y & z] ;; remove ampersand to make this script work [v x y z]))] (println (.meth obj 1 2 3))) produces an error: ersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [self__.v, ReferenceError: self__ is not defined Thanks in advance. -- 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] Issue: reify Object with vararg method
Protocol methods do not support var args. We should probably add a syntax check for this, http://dev.clojure.org/jira/browse/CLJS-1445 David On Fri, Sep 11, 2015 at 12:13 PM, Yuri Govorushchenko wrote: > Hello, > > I guess I've stumbled upon a compilation error. The repo for reproducing > is here: > > https://github.com/metametadata/cljs-reify-error > > TL;DR: > > (let [v 123 > obj (clojure.core/reify >Object >(meth [this x y & z] ;; remove ampersand to make this script > work > [v x y z]))] > (println (.meth obj 1 2 3))) > > produces an error: > > ersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, > [self__.v, > ReferenceError: self__ is not defined > > Thanks in advance. > > -- > 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] es7 vs core.async
This is an extension to a reply to a Reagent user about running multiple async ops in parallel and executing some handler when all finish. I am wondering if my hunch is correct that CSP is a necessary abstract model for async processes that require complex coordination and/or communication but that it is too much in simple cases like when multiple xhr requests to the server in parallel and running a handler when they all finish passing it the responses as an array. The proof is in the pudding and despite CSP being far more flexible and powerful I can't help but think that for certain cases it is not the ideal solution which brings up my previous question to the list: why call it core.async when in facf it is core.csp? Maybe I'm wrong. If I am show me how to write a simple one line of code in core.async to implement the aforementioned simple case. Here is a copy of my reply on the Ragent list to a user wishing to implement the simple case (too lazy to type it again) "So far, to my understanding, core.async is a CSP implementation that adheres to the Go implementation of CSP. My use of it in JS land is via async-csp (CSP implemented on top of es7 async functions) and has been mostly as a factorization tool, to make pretty and digestible those async patterns that involve coordination and/or communication between async processes. For example, in JS, if you need to run something when N async processes complete and don't want to use the silly '.then' approach, and you don't want to use a dynamic counter approach (not fancy enough for you) you could do it in one line of code within an es7 async function with something like "await Promise.all([asyncOp1, asyncOp2, asyncOp3])" and that is all it takes, definitely more concise that using a CSP pattern. It is try-cath-able, too." Show me the money! No seriously, what am i being an idiot about here? I feel like es7 is giving us more options with async functions and CSP is just a subset of the abstract models that can be implemented via es7's async functions, which I believe are just syntax sugar on top of native Promise. Speaking of Promise, there is a proposal to remove the need for accessing the Promise API in the case presented above using await* (with *) Please educate. Thank you Marc Sent from my iPhone -- 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] Favorite Web Stacks and why
- sente, transmit, edn and core.async for a seamless two-way 'channel' between front and backend - re-frame for subscriptions and just-enough architecture for your UI - reagent for a very light-touch way of describing your UI (om could also be placed here) - http-kit on the server side - prismatic schema everywhere - Stuart's Component system for just enough plumbing to manage components - Cursive for the best Clojure IDE in the world or emacs/cider for the best text editor in the world :-) (Cursive and Cider - you both rock!) HTH On 11 September 2015 at 15:21, Jamie Orchard-Hays wrote: > I’m curious what your favorite web stacks in Clojure and Clojurescript are > these days. Client and server libs you like to use and what you like and > don’t like about them. > > Cheers, > > Jamie > > -- > 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] Favorite Web Stacks and why
What is Stuart's Component system? :) Sent from my iPhone > On Sep 11, 2015, at 9:40 AM, Colin Yates wrote: > > - sente, transmit, edn and core.async for a seamless two-way 'channel' > between front and backend > - re-frame for subscriptions and just-enough architecture for your UI > - reagent for a very light-touch way of describing your UI (om could > also be placed here) > - http-kit on the server side > - prismatic schema everywhere > - Stuart's Component system for just enough plumbing to manage components > - Cursive for the best Clojure IDE in the world or emacs/cider for the > best text editor in the world :-) > > (Cursive and Cider - you both rock!) > > HTH > >> On 11 September 2015 at 15:21, Jamie Orchard-Hays wrote: >> I’m curious what your favorite web stacks in Clojure and Clojurescript are >> these days. Client and server libs you like to use and what you like and >> don’t like about them. >> >> Cheers, >> >> Jamie >> >> -- >> 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] Favorite Web Stacks and why
https://github.com/stuartsierra/component On 11 September 2015 at 17:42, Marc Fawzi wrote: > What is Stuart's Component system? :) > > Sent from my iPhone > >> On Sep 11, 2015, at 9:40 AM, Colin Yates wrote: >> >> - sente, transmit, edn and core.async for a seamless two-way 'channel' >> between front and backend >> - re-frame for subscriptions and just-enough architecture for your UI >> - reagent for a very light-touch way of describing your UI (om could >> also be placed here) >> - http-kit on the server side >> - prismatic schema everywhere >> - Stuart's Component system for just enough plumbing to manage components >> - Cursive for the best Clojure IDE in the world or emacs/cider for the >> best text editor in the world :-) >> >> (Cursive and Cider - you both rock!) >> >> HTH >> >>> On 11 September 2015 at 15:21, Jamie Orchard-Hays >>> wrote: >>> I’m curious what your favorite web stacks in Clojure and Clojurescript are >>> these days. Client and server libs you like to use and what you like and >>> don’t like about them. >>> >>> Cheers, >>> >>> Jamie >>> >>> -- >>> 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. -- 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] Issue: reify Object with vararg method
Thank you, David. I knew it's not supported in Clojure. However I assumed ClojureScript supports this syntax since everything works as expected if v is not used inside method body :) пятница, 11 сентября 2015 г., 19:22:10 UTC+3 пользователь David Nolen написал: > Protocol methods do not support var args. We should probably add a syntax > check for this, http://dev.clojure.org/jira/browse/CLJS-1445 > > > David > > > On Fri, Sep 11, 2015 at 12:13 PM, Yuri Govorushchenko > wrote: > Hello, > > > > I guess I've stumbled upon a compilation error. The repo for reproducing is > here: > > > > https://github.com/metametadata/cljs-reify-error > > > > TL;DR: > > > > (let [v 123 > > obj (clojure.core/reify > > Object > > (meth [this x y & z] ;; remove ampersand to make this script work > > [v x y z]))] > > (println (.meth obj 1 2 3))) > > > > produces an error: > > > > ersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [self__.v, > > ReferenceError: self__ is not defined > > > > Thanks in advance. > > > > -- > > 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 clojurescrip...@googlegroups.com. > > To post to this group, send email to clojur...@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] React-dom and Web Workers
I just found out that the DOM manipulation part of React has been split off as react-dom. So in my limited understanding, it should be possible to run the diffing algorithm (any algo that can take previous and current state and spit out a DOM diff) in a web worker thread and send the diff over to react-dom to patch the DOM. This means expensive diffing can happen in a separate thread. https://github.com/facebook/react/issues/3092 it also means the diffing algo can be written in ClojureScript and that it can target react-webgl as opposed to react-dom. Is there anyone working in this direction? Sent from my iPhone -- 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: "Redirect-after-post" using secretary?
On Tuesday, December 2, 2014 at 3:45:52 AM UTC-8, Russell Dunphy wrote: > I'm trying to get my head around structuring my client-side routes (in a > reagent app) using secretary, and I'm struggling to work out the best way of > dealing with the "redirect-after-post" scenario where I have a form that is > submitted via AJAX, and once the AJAX request has successfully completed, I > want to change to a different page to view the saved record. > > The two ways I can think of to achieve this are: > > 1. Have the on-click event of the submit button make the ajax request, and > have the success handler call secretary/dispatch! to the new page. > > This has the disadvantage of not changing the url hash, so links back to the > form don't work until you've changed pages again normally. > > 2. Replace the submit button with an anchor tag pointing at a different > secretary route, something like /my-model/create, which makes the POST > request and renders the new page. The problem with this approach is that you > have to get the form data to the secretary route somehow, either by having it > as params on the URL, which seems a bit pants, or by having it in a state > atom that both the form and the secretary route knows about (which seems like > data that shouldn't be shared). > > How are other people doing this? Am I on completely the wrong track? > > Thanks, > > Russell Hi Russell, Have you got this problem solved? ( I would think you have as it is long time back.). Would you mind posting your resolution here? Thanks in advance. I am facing a similar issue here. The response to curl is as follows: HTTP/1.1 302 Found Server: undertow X-XSS-Protection: 1; mode=block Location: http://localhost:3000/login <- X-Frame-Options: SAMEORIGIN Date: Fri, 11 Sep 2015 21:06:28 GMT Connection: keep-alive X-Content-Type-Options: nosniff Content-Type: text/html; charset=utf-8 < Content-Length: 0 However, the reagent form is not getting redirected to he /login form. It remains in the same form. On the console, I can see, however, the login page is streamed as an HTML. ( I am using "/login" as just as an example.). The original reagent page is doing a request with CLJS-AJAX POST. Any hint is much appreciated. Thanks, Regards, Hari -- 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: How do you retrieve the value of an item in a listbox, in Clojurescript?
On Friday, September 11, 2015 at 8:58:56 AM UTC-4, Dan Campbell wrote: > Hi, > > I've been having some difficulty, locating documentation that explains how to > get a listbox item value. There are loads of examples of how to obtain or > set the value of a text area, or of a browse-style list. > > I think the problem is that, in the html, it's not actually called 'listbox', > and therefore a Google search isn't producing optimal results. > > So if we have a listbox lst_01 as below, how would we obtain the second item > ("Value_02")? > > style="position:absolute;left:435px;top:293px;width:162px;height:74px;z-index:25;" > title="lst_01"> > Item_01 > Item_02 > Item_03 > > > > If we try to get the listbox object, by setting lst_01 to > > ( ef/from "#lst_01" ( ef/read-form-input ) ) > > > , then the contents of lst_01 in Clojurescript, is just a unit set of the > first (selected) value > > #{"Value_01"} > > > Is there a way to obtain non-Selected values, anywhere in the listbox? Or a > vector/list of all values? > > It's clear how to do this in Javascript, but I'd like to stick with > Clojurescript idioms, preferably with Enfocus. But even a non-Enfocus > example, would help. In case anyone is having similar issues, here is Creighton Kirkendall's solution (he maintains Enfocus): You should be able to get it from the options like this. (from "#lst_01 > option" (get-prop :value)) , and it does indeed return the list of values, in that listbox. -- 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
Clojure 1.7 introduced Reader Conditionals which allows you to write one Clojure file (with a .cljc) extension, and use conditional expressions to let Clojure make Java calls and ClojureScript make JavaScript calls. How easy or hard it would be to convert a Clojure library to a Clojure/ClojureScript library depends entirely on how much platform specific code the library has used and what similar facilities exist in the target platform. I dare say most library authors would welcome a pull request to support cljc if you did the work of porting it. On Fri, Sep 11, 2015 at 12:27 AM Dan Campbell wrote: > On Tuesday, September 8, 2015 at 7:14:57 PM UTC-4, Linus Ericsson wrote: > > 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. > > Hi Linus, > > Well, I'll need a library that that solves algebraic equations, at some > point. Generally, math libraries, like Clojuratica and Expresso. > > -- > 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. > -- Daniel -- 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] Redirect in a SPA on the server side.
Hello All, I am working on a use case as follows: The UI is with reagent, re-frame for subscription & Luminus, and for the backend, I use Compojure. I also tried with Liberator, but for simplicity, I am using only Compojure now. I also use Secretary & cljs-ajax for SPA routing and ajax. -> User brings up "/person" URL, and use a set of actions. The page data is sent to the backend, gets validated and saved to the DB. Then the user has to be re-directed to "/job". If there is any error, the errors will be displayed on the "/person" page. There are two application components -- one with the URL "/person",and the other with "/job". With each of these, I have a few related pages, and I am creating them as SPA with Reagent. The question is how do I redirect to the "/job"? Client Side Code (only the the relevant ones) (POST "/person" {:headers {"Accept" "application/clojure"} :params @doc :handler ex-handler :error-handler ex-error-handler}) Server: (defn process-person [] (-> (redirect "/job" :permanent) (header "Content-Type" "text/html; charset=utf-8") (header "Location" "/job") ) ) (POST "/person" [params] (process-person params)) Interestingly, on the console, I can see the HTML for the "job" page. Do I have to change the Secretary code to make it happen? Any help is much appreciated. Regards, Hari -- 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.