Fork me on GitHub
#hoplon
<
2015-11-03
>
thedavidmeister09:11:38

@alandipert: i just tried your advice for heroku deployment. works for me simple_smile

shadaen13:11:17

Hi guys, I am new on http://hoplon.io and I wuld like to know if there is any ressource on how to manage event like :

shadaen13:11:45

I would like to test if the keydown or keypress is of keycode 13 (enter)

micha13:11:39

@shadaen: the argument passed to the event handler is the jquery event object

micha13:11:48

you can get all information about the event from there

shadaen13:11:01

@micha: Hum, so @% is containing the event object ? If yes, I should write a little function parsing this event and getting the code from it. I will try to do it. And come back if I have any problem ^^. And just another question, what is the meaning of #(....) why use # ?

alandipert13:11:23

@shadaen: #(reset! new-item @%)) == (fn [e] (reset! new-item @e)) == (fn [e] (reset! new-item (deref e)))

alandipert13:11:35

the # is clojure syntax sugar for making anonymous functions tersely

alandipert13:11:11

@x is sugar for (deref x), and works in this case because in cljs 'deref' is a protocol/interface, and we have implemented deref on the jq event object as .val

micha13:11:13

also it's just %that is the event object

shadaen14:11:51

hum ok, I think I understand it. It's hard by moment to understand clojure. Thanks again guys for you help I will be able to play again with hoplon simple_smile

alandipert14:11:48

:keydown (fn [e] (when (= (.-which e) 13) (reset! new-item @e))

micha14:11:25

in js it would be equivalent to

micha14:11:24

$(elem).on("keydown", function(e) { reset(new_item, e.target.value) })

micha14:11:59

some artistic license take with the translation, of course

shadaen14:11:00

@micha: thanks for this illustration

shadaen14:11:48

@alandipert: this version seems more natural for me.

alandipert14:11:03

@shadaen: you may consider the :change event instead... it would give you the same result i think

statonjr14:11:54

Does HLISP exist as a library outside of Hoplon?

alandipert14:11:22

@statonjr: somewhat, https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs is in the hoplon jar and would be usable from any cljs thing

statonjr14:11:42

Right. I’m wondering if it could be made usable from any clj thing (cljc?).

statonjr14:11:46

I’ll take a look.

alandipert14:11:35

possibly, to some degree. the big magical thing that hoplon does is install head/body when the page loads

alandipert14:11:47

but presumably you could write your own cljs to do that part

statonjr14:11:16

Excellent. Thanks.

onetom18:11:13

@alandipert: who is wooby? it seems s/he (it? simple_smile deployed hoplon-alpha11 from this commit https://github.com/hoplon/hoplon/commit/9ba3aacb159a9a0cfd375ad2f6d303999ae4fee3 which is 404 can you ask the person to push, pls?

onetom18:11:04

i was trying out alpha11 today because we are experiencing some run-away memory consumption again (especially combined with boot-reload), but alpha11 didn't help

onetom18:11:07

i've also noticed that the when-dom function is still in the source https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs#L564 we were talking about this because it seemed unnecessary. can't find the exact conversation but was around this time: http://clojurians-log.mantike.pro/hoplon/2015-09-25.html you said you would try your app without it too, but we haven't got back to the issue since. im suspecting if we could get rid of this or safeguard it at least, then we could avoid memory leaks and also a small but constant level of cpu extra cpu usage even when the page is idle.

onetom18:11:54

i suspect you might not be affected because you are less likely to write leaky code, but in our case it still seems to happen from time to time 😞

martinklepsch18:11:34

@onetom: memory issue in browser?

onetom18:11:21

if we disable boot-reload it gets a bit better but still a manual reload of the page takes 5-15 seconds

onetom18:11:58

and within a 1-2minutes usage mem utilization crawls up from 250MB to 900MB

onetom18:11:05

i will work more on narrowing the cause tomorrow, but having infinite loop in the framework (in form of that when-dom) doesn't exactly help debugging

Josh20:11:59

(been mostly out of Hoplonland lately but in it enough to say) good luck presenting tomorrow @alandipert!

alandipert21:11:53

@onetom: sorry about that, pushe dnow

flyboarder23:11:37

my :selected attribute always seems to resolve to selected=“selected” instead of my formula cell value? Is there a way I can work around this?

flyboarder23:11:25

if I update the html in devtools it works correctly