
Real-Time Web Apps with Zero Lines of JavaScript - adamstep
https://engineering.instawork.com/real-time-web-apps-with-zero-lines-of-js-d2a3d6dd10d
======
whereareyouwow
Wow Adam! I owe you a drink! I have been looking for something like
intercooler + sse / mercure. What a great example of NoJS!

I thought I was stuck with just amp ([https://amp.dev](https://amp.dev)) as an
option. Please ignore the nitpickers saying it is technically not zero lines
of js.

If the app can be developed without writing js, it can be considered nojs. The
list here ([http://markapp.io](http://markapp.io)) is based on that principle.

Please please keep on chronicling your adventures. So many questions but I
will take the weekend to explore properly.

~~~
adamstep
I totally agree, the benefit of NoJS comes from not needing to write custom
code in order to implement a feature. Thanks for the link to that list of
other NoJS libraries. If you have any questions about Intercooler, please
leave a comment on the post.

------
DoctorPenguin
So you use JavaScript libraries to avoid writing JavaScript to use a
JavaScript browser API?

~~~
adamstep
That's right. By including the Intercooler.js library, we don't need to write
custom JS when developing features in our web app. We can take full advantage
of JS APIs like AJAX and EventSource by only adding declarative HTML
attributes to our markup.

------
james_s_tayler
I think this kind of approach is really underrated. I remember from playing
around with Rails that you can do very similar things quite easily.

It's not a popular approach at the moment, but I do feel like there is
validity to it.

Kudos for taking the road less travelled.

------
zaro
So this is being done just for the sake of not writing JS?

I don't see how this will be in any way better or more maintanalbe. Also it
means writing more Django/Jinja templates.

~~~
vearwhershuh
These articles might help:

[http://intercoolerjs.org/2016/01/18/rescuing-
rest.html](http://intercoolerjs.org/2016/01/18/rescuing-rest.html)

[http://intercoolerjs.org/2016/05/08/hatoeas-is-for-
humans.ht...](http://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.html)

Apps written in this manner (when properly decomposed) are very maintainable
and often markedly simpler than a client-server SPA model. It isn't a popular
approach right now, but that's OK. We are all independent thinkers here on
HackerNews, right?

------
Porthos9K
Less JS is always better, but if you're using Intercooler.js, are you really
creating an app with "zero lines of JS"?

~~~
adamstep
It's true we include Intercooler.js and jQuery in our web app. What I meant is
that as developers working on our web app, we don't need to write JS to
implement new features. All of the logic happens in the Django codebase.

~~~
Porthos9K
You don't have to write _any_ JS at all to leverage Intercooler.js and JQuery?

At least Milady de Winter had the courtesy to be attractive when she tried to
bullshit me and my buddies back in the day.

~~~
adamstep
That's right, check out
[https://intercoolerjs.org/docs.html](https://intercoolerjs.org/docs.html) for
a primer on how it works. Interactions and AJAX requests are declared using
HTML attributes, the responses are server-rendered and swapped on the
frontend.

------
vearwhershuh
Very cool Adam.

You are officially the worlds expert on using server sent events in
intercooler. ;)

~~~
adamstep
Thanks! There's so much potential there, we're excited to push the limits.

