Live data from Hacker News

Stimulus: A modest JavaScript framework for the HTML you already have

stimulusjs.org

31–40 of 65 posts

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#31
> export default class extends Controller {

I know it is vanilla ES6, but at some point it starts looking more like Java than JavaScript. The boilerplate necessary to convey a simple instruction is directly proportional to the averaged speed of everything else (authorship, maintenance, execution, testing, frequency of reuse, and so forth).

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#32

Previous discussion: https://news.ycombinator.com/item?id=16052105 I've been using Stimulus + Turoblinks for my current side project and I love it. Nice and simple way to add a bit of interactivity to existing HTML on your page.

*Turbolinks, copy/pasted that for Google and didn't find anything relevant. Edit: thanks, I found it, I was just pointing out to the typo so other people don't get confused.

https://github.com/turbolinks/turbolinks

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#33

Previous discussion: https://news.ycombinator.com/item?id=16052105 I've been using Stimulus + Turoblinks for my current side project and I love it. Nice and simple way to add a bit of interactivity to existing HTML on your page.

*Turbolinks, copy/pasted that for Google and didn't find anything relevant. Edit: thanks, I found it, I was just pointing out to the typo so other people don't get confused.

Turbolinks is a feature in Rails. See for example https://github.com/turbolinks/turbolinks

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#34

Previous discussion: https://news.ycombinator.com/item?id=16052105 I've been using Stimulus + Turoblinks for my current side project and I love it. Nice and simple way to add a bit of interactivity to existing HTML on your page.

*Turbolinks, copy/pasted that for Google and didn't find anything relevant. Edit: thanks, I found it, I was just pointing out to the typo so other people don't get confused.

[deleted]

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#36
post #26

We wrote a pretty similar (like similar enough its kinda creepy) library[1] a while back and it's really helped speed up our front end dev. I LOVE having params set in data attributes. Makes re-usable modules, like a modal[2] or autocomplete [3], way easier to implement. [1] https://github.com/firstandthird/domodule [2] https://github.com/firstandthird/simple-domodal [3] https://github.com/firstandthird/complete

I did two other frameworks that are super similar, hooked up with dynamic loading of the code with webpack, and the older one RequireJS. It's a super awesome pattern, that makes things super simple and it's super lightweight as well.

Unfortunately they get crazy bloated when we transpile them down for older ie. I believe we’re going to be using the new Babel stuff to hopefully easy that a bit. Ie 10 is still a sore spot though :/

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#38
post #35

This has a lot of similarities to intercooler.js http://intercoolerjs.org/ which I really enjoy when I don't need a full SPA type experience. Can anyone with experience of Stimulus suggest why I'd pick it over intercooler?

I’m not very informed about intercooler, but from the examples it seems to focus on AJAX requests. Stimulus is more about DOM manipulation, things you would’ve used jQuery for (except $.ajax and related). Toggle classes to show/hide things, move things around (mostly also just by toggling classes these days), create/duplicate elements, stuff like that. Stimulus also does some AJAX, but I can easily imagine these two work together in one page for different elements.

Re: Stimulus: A modest JavaScript framework for the HTML you already have

#39

> export default class extends Controller { I know it is vanilla ES6, but at some point it starts looking more like Java than JavaScript. The boilerplate necessary to convey a simple instruction is directly proportional to the averaged speed of everything else (authorship, maintenance, execution, testing, frequency of reuse, and so forth).

Do you mind expanding on what you mean? When I look at the instructions here, they seem pretty concise.

`export` -> exports the thing

`default` -> if you require from this module, this is the default

`class` -> class definition

`extends` -> speaks for itself

`Controller` class it's extending.

You could maybe rework it so you don't export it on the same line:

```

class Foo extends Controller {}

export default Foo

```

The parallel I see here to Java is the object orientation - which is a fair criticism. There are probably ways to execute on this using other mechanisms other than inheritance. But then, sub-classing to me still feels better than assigning the prototype via direct assignment.

Post reply on HN