hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
denis_krivosheev 2019-02-28T05:44:14.004600Z

@flyboarder yes, I’m using boot. This is just a default starter project from documentation. I added some dependencies but removed or changed nothing. I checked out and other handlers work fine (click for example).

flyboarder 2019-02-28T07:52:13.005400Z

@denis_krivosheev I see, you can’t attach scroll to body

flyboarder 2019-02-28T07:52:31.006100Z

Second response down

denis_krivosheev 2019-02-28T08:04:00.007600Z

I see. Is there a way to do it properly in hoplon? I tried this: (set! js/document.body.onscroll #(println %)) and this works, but looks kinda hacky

denis_krivosheev 2019-02-28T08:05:16.008Z

btw thank you for a great framework! It’s awesome!

1
flyboarder 2019-02-28T17:36:51.008600Z

@denis_krivosheev what are you trying to accomplish? Maybe I can suggest something else, in general you don’t want events attached to the body element.

denis_krivosheev 2019-02-28T18:02:37.009900Z

@flyboarder I want to have top-level infinity-loading paginable screen. Just a regular pattern, scroll to the bottom and when you are quite close then load more data

denis_krivosheev 2019-02-28T18:03:38.010900Z

I know that I can attach this handler to the div, then scroll div and not body, but this is kinda hacky too

flyboarder 2019-02-28T18:05:50.012400Z

No the div is the correct way to do it, you can’t have a scrolling body with infinite space as per the comments on that SO link I posted

flyboarder 2019-02-28T18:07:40.015100Z

@denis_krivosheev ^ there may be other work arounds but attaching an event to the body is the same as <body onscroll=....> it does not replace the onscroll handler like the snippet you posted does.

denis_krivosheev 2019-02-28T18:09:03.015400Z

Ah ok, I see. Thank you!

denis_krivosheev 2019-02-28T18:10:16.016300Z

Btw @flyboarder does hoplon has some batching functionality or should I use some other tool to batch events?

flyboarder 2019-02-28T18:13:40.016700Z

What type of events?

flyboarder 2019-02-28T18:14:03.017300Z

@denis_krivosheev ^ Dom Events?

denis_krivosheev 2019-02-28T18:14:49.018Z

Yes, like scrolling or mousemove. Dom triggers a lot of them

flyboarder 2019-02-28T18:15:08.018400Z

We don’t do anything special with that

flyboarder 2019-02-28T18:15:25.018900Z

Everything Hoplon does could be done in vanilla JS

flyboarder 2019-02-28T18:15:33.019100Z

+ jquery

denis_krivosheev 2019-02-28T18:16:06.019600Z

This is just perfect 👍 react go away 😃

2019-02-28T18:38:23.020Z

anyway debouncing and throttling are fun functions to write for yourself in cljs 😄