This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (13)
- # announcements (1)
- # aws (17)
- # beginners (1)
- # boot (113)
- # cider (71)
- # cljs-dev (7)
- # clojure (93)
- # clojure-android (2)
- # clojure-berlin (1)
- # clojure-dev (22)
- # clojure-italy (3)
- # clojure-japan (1)
- # clojure-poland (41)
- # clojure-russia (96)
- # clojurescript (140)
- # cursive (11)
- # datomic (27)
- # devcards (1)
- # devops (1)
- # events (4)
- # funcool (3)
- # hoplon (133)
- # immutant (7)
- # ldnclj (22)
- # leiningen (5)
- # off-topic (6)
- # om (22)
- # onyx (12)
- # re-frame (8)
- # reagent (12)
state goes into cells, and formulas react to changes in state in the normal javelin way
mkremote functions do return is a jQuery promise you can use to handle errors, for example
how do you mean? where is state generated then?
(let [user (cell nil) pass (cell nil)] (form :submit #(login! @user @pass) (label "User: " (input :change #(reset! user @%))) (label "Pass: " (input :type "password" :change #(reset! pass @%))) (input :type "submit")))
and presumably some user data will end up in there, as that's what the
my.namespace/login! function in the server will return
then you will have formulas looking at
stem-cell1 that might hide the login form and show something else
but the form you see there doesn't care what happens when the user successfully logs in
where does stem-cell1 get defined? in the hoplon page?
ok so it could be any cell
and that goes for every bit of the application which needs to show or hide itself
however when doing so avoid nesting cell=
(html (head ...) (body (div :toggle logged-out? ;; login form here ) (div :toggle logged-in? ;; logged-in content here )))
ok im tracking
compare to making an async AJAX call and attaching callbacks to show/hide all the various things
this way the login form doesn't even know that an ajax call is being made, it just calls a function
so you can factor the whole login form into a separate component that can be used in any application
ok i will need to do some more digging on castra
@flyboarder: https://github.com/hoplon/demos/tree/hoplon6/castra-chat is updated to use hoplon6 but not the latest neither castra3. But it runs on boot2 😉
@mynomoto: thanks i was looking at that a bit earlier
how far off is it from a castra3 implementation?
is 2.2 very different from 3?
@flyboarder: just a couple of hours, there is not that many differences. For a really simple project you can run
lein new hoplon-castra your-project-name to generate a project that uses the latest hoplon and castra.
The main differences are internal, cljson -> transit, a castra session. The main practical difference is that castra is now a middleware instead of a handler.
as in it does things on both side of the response?
No, as you can use like https://github.com/tailrecursion/hoplon-castra-template/blob/master/src/leiningen/new/hoplon_castra/handler.clj#L17
@mynomoto: so I can mixin any other ring middlewares then as well
how does that work with other things such as using the rest routes for an API?\
You need to apply the castra middleware only on some of the routes since it intercepts all post requests, so don't apply it on routes that will receive those requests. Other than that you can mix and match at will.
sorry not sure what you mean by that?
how is it applied to only some?
would I be creating an api app with a different route list?
In the end you need only one app, but you can have middleware applied only on part of it. http://stackoverflow.com/questions/28016968/serving-app-and-api-routes-with-different-middleware-using-ring-and-compojure
night, also git the sack
boot dev on the
hoplon-castra lein template gives me this stacktrace - https://www.refheap.com/109669
Running on windows if that's important
@mynomoto: I just realized I changed clojure's version to 1.8.0-alpha5, 1.7.0 works fine
Just got my first castra rpc call working
i just updated and posted a minesweeper game i abandoned, https://github.com/alandipert/hoplon-minesweeper
it needs the expand-adjacent-non-mines function still, but that would be fun to write
@flyboarder: we are sharing sessions stored in mongodb between our castra backend and our legacy nodejs app i think i can share the related code if it's not already shared. (though i was just deleting something like that today... i hope it was pushed to some other server
@alandipert: the original version had a couple more features, most notably middle-clicking a cell that already had all the flags it needs to set up would flip all the non-flipped neighbors at once
@micha: I remember you said formulas referencing other formulas are a code smell to you, yet here in Alan's minesweeper I see many formulas like that
@xifi: i think he was saying something like creating new formula cells within formula cells are a problem (causes memory leak if im correct)
(def stem (cell 123)) (def double-squared (cell= (let [double (cell= (* 2 stem))] (* double double))
(def stem (cell 123)) (def double (cell= (* 2 stem))) (def double-squared (cell= (* double double)))
if you do like
(cell= (cell= foo)) or something you're creating new formulas each time the thing is recomputed
@micha: i wonder if cell= should complain if it has cell= in it?
i guess it couldn't really know
@onetom: I would appreciate any code you can share, im still new to clojure so seeing real world applications helps connect all the pieces together, @micha really got me tracking yesterday with the whole application development model in hoplon
@micha: am I correct that creating an anonymous cell= at runtime within a cell= would also cause problems
@flyboarder that's what i was saying yes
I just launched the nukes on my linux notebook, the damn thing won't load my /home partition 😞
@micha ah I see that was probably the issue I was having before, refactoring yet again 😛
just a few questions about hoplon, there used to be a documentation but since the new design where has all the data gone?
- is it normal that the "A stateful custom element" example the timers show different times?
- if I wanted to do a SPA that were to live in cordova, can HLisp be compiled to say app.js and be included as a lib? (like OM)
@sjol: hi, yes, the old docs are in history but they were too out of date for us to keep public
to answer your questions: 1. yes it is normal, the point of that demo is to demonstrate that different instances of the same component can maintain their own state
2. i haven't made a mobile app with hoplon but but others here have
re: 3. and example is https://github.com/hoplon/demos/tree/hoplon6/castra-chat
we advocate https://github.com/hoplon/castra for server comm but any technique you use that can get values into cells is an option
nice! And have you tried to use javelin with lib like D3.js? are there any caveat I should know about? ( OM has a few, which is why I ask )
i have done some d3, and there aren't any gotchas i'm aware of
@alandipert: i cant seem to get castra-chat to build
great, my intent is to use a cell as the data source and have the data change thus the d3 visualization change
it complains about missing hoplon, do the new versions not build yet?
Could not locate tailrecursion/boot_hoplon__init.class or tailrecursion/boot_hoplon.clj on classpath
right outta the hoplon6 repo
this is from the hoplon/demos repo hoplon6 branch
ok sounds good, but im confused as to why it is looking for the tailrecursion namespace at all? it's not in the deps file anywhere
wait I see it
it was in the boot file above looking for boot-hoplon