This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-03
Channels
- # adventofcode (6)
- # bangalore-clj (1)
- # beginners (15)
- # boot (4)
- # cider (14)
- # clara (1)
- # cljs-dev (1)
- # clojure (115)
- # clojure-art (1)
- # clojure-france (1)
- # clojure-greece (1)
- # clojure-korea (9)
- # clojure-russia (1)
- # clojure-spec (62)
- # clojure-taiwan (1)
- # clojure-uk (18)
- # clojurescript (5)
- # component (1)
- # cursive (3)
- # datascript (2)
- # datomic (17)
- # devcards (2)
- # editors (4)
- # emacs (65)
- # events (2)
- # funcool (4)
- # hoplon (92)
- # jobs (6)
- # london-clojurians (1)
- # luminus (1)
- # midje (2)
- # mount (1)
- # off-topic (1)
- # onyx (51)
- # protorepl (6)
- # re-frame (116)
- # reagent (7)
- # ring (2)
- # spacemacs (2)
- # specter (4)
- # untangled (1)
- # yada (1)
@laforge49: why not toggle the style based on a cell?
And, @flyboarder, I reuse the same elements, each time with a different style.
So I think dynamic style is the way to go, hmm? Only I need to refresh the element after modifying the dom.
Which happens each time a cell changes on the element
There is only a certain number of styles that could possibly be used, you should be toggling based on that list
Yeah. So my next attempt will set the value to be displayed in the innerHTML, which will likely cause the refresh.
I believe in you!
Is there a good way to make window.setInterval play nicely with live code reloading?
I have a cell that I want to increase by one every second but, beside using defonce store the result of calling setInterval, I'm not sure if there's a good way to prevent the interval function from being called more frequently.
@alandipert i like the idea of order being predictable at least
order of adding seems as good as any
i have definitely come up against subtle bugs in my code from the specific order of cells doing their thing
@fiddlerwoaroof would a recursive set timeout work better?
@fiddlerwoaroof Doesn't defonce work for you?
@flyboarder it works! I set the content after the element is created and after setting the style dynamically by assigning it to innerHTML--which forces the refresh. Also complicating things was that, when displaying multiple lines, I was grabbing the wrong element. But anyway, I am happy that I can reuse elements in a scrollable display with dynamic styling. Thanks!
@laforge49 is that public? The way you are describing seems like as you are fighting Hoplon. If it's public I would like to take a look.
@mynomoto You are right. I don't need some of this and could go back now and drop it. I can just add the style in the div itself. Anyway, here's the code: https://github.com/rolonicArk/simpleArk/blob/master/src/console/client.cljs
Start with the do-console called at the end of the module. The console is displayed at the end of that. Then look at add-output which adds content to the console display.
@mynomoto No rush. I've now cleaned up the code. No more "dynamic styling". I'm groovin with Hoplon! 🙂
@laforge49 Is something like this that I should be looking at?
@thedavidmeister it took me a while to figure out what you meant, but I think a recursive setTimeout might be the way to go @mynomoto defonce works, but it makes it annoying to experiment with the defonced value.
@fiddlerwoaroof you can cancel the setInterval and create another one. You get an id when you define it.
@fiddlerwoaroof @mynomoto https://github.com/hoplon/hoplon/blob/5200ba855b494b3a8a69b2e3308ebc9d178d215c/src/hoplon/core.clj#L264-L267
@micha cool! Is it ok to merge the docs generated with codox? We will gain some visibility over the public API, I can add docs later.
There is lots of missing docs but there is a list of public things. You may want to take a look to see if there is something that shouldn't be public 😉
@mynomoto: that doesn't seem to cover the cljs stuff, just clj?
I think we should use Codina for docs if we want the cljs stuff
Oh sorry I just looked at the namespaces, I guess there aren't docs for multimethods the hoplon.jquery stuff
Which is a shame, I should be able to document an implementation
@mynomoto: well carry on then 😛
@flyboarder I picked codox as it has a klipse plugin if we ever get that to work it would be amazing for docs.
Awesome!! Agreed that would be pretty slick!
@mynomoto Yeah, but it looks broken. I've been making too many changes too quickl. 🙂
@laforge49 no problem, looks interesting 😃
@micha when you are making a client web app what is the model you use?
@flyboarder what do you mean by "model" there?
Like mental model for the application
I was watching @shaun-mahood presentation from the conj and it made me start thinking about the structure of applications
@flyboarder i think about it as a collection of state machines
then the other side is the "presentation", which is hoplon defelems that can be hooked up to the state machines
That's a really good way of describing it
I'm taking notes for my presentation btw
in general i guess the way i think of it is that at the end of the day you want to present a browser dom interface to the user
so to hook the state machine up to some ui compoenent(s) you would wire up the fields of the state machine (which are cells) to the attributes of the component
so in larger applications we should be using records of cells instead of just cells?
if i can factor out the workflow, or some aspect of it, then i make a state machine thingy
that really simplifies the appliaction because then i can make more powerful components
very interesting, i have a theme developing for this tutorial on mental models for web apps, the nice thing about hoplon is that the ast is the dom structure so you can see the dom by looking at the code
and then attributes connect off to all the state and logic
your breakdown of it is much more concise 😁