Comment by bullen

Comment by bullen a day ago

4 replies

What is the advantage over just using this:

  var source = new EventSource('pull?name=one');
  source.onmessage = function (event) {
    document.getElementById('events').innerHTML += event.data;
  };
http://talk.rupy.se/event.html

> If you need bi-directional communication, then you should consider using WebSockets instead.

Or you just do a HTTP request?

anamexis a day ago

Everything HTMX does could be "just" done using JS - this is self-evident. The whole point of HTMX is to enable features like this directly in HTML.

infamia a day ago

If you do that you'll reset browser state with whatever you're replacing. For example things like scroll position, if the user opened an accordion, etc. would all be lost.

recursivedoubts a day ago

I mean you're not wrong: end of the day htmx is just some javascript written on top of standard vanilla javascript apis. It tries to handle things in a more html-centric, attributes-driven manner than script-oriented approaches do, but it's nothing too complicated

check out fixi for our ultra-minimalist take on the idea:

https://github.com/bigskysoftware/fixi

Or, for extreme minimalisim, htmz, which repurposes iframes for a similar idea:

https://leanrada.com/htmz/