Stimulus Icon

Stimulus

A modest JavaScript framework for the HTML you already have.
3 Stories
All Topics

Changelog Interviews Changelog Interviews #286

JavaScript sprinkles in Basecamp turned Stimulus

David Heinemeier Hansson (DHH) shares the story of how JavaScript sprinkles in Basecamp evolved into a full-fledged framework called Stimulus. We talked about ins and outs of Basecamp as it is today, Ruby, JavaScript, David’s somewhat new found love for JavaScript, how they open source because they can, and David’s new YouTube series called “On Writing Software Well”.

David Heinemeier Hansson m.signalvnoise.com

Stimulus 1.0: a modest JavaScript framework for the HTML you already have

When you combine the gains of Turbolinks and Stimulus…

Turbolinks maintains a persistent process, just like single-page applications do. It intercepts links and loads new pages via Ajax. The server still returns fully-formed HTML documents. This strategy alone can make most actions in most applications feel really fast. For Basecamp, it sped up the page-to-page transition by ~3x.

But Turbolinks alone is only half the story. Prior to Stimulus, Basecamp used different styles and patterns to apply “JavaScript sprinkles”.

Stimulus rolls up the best of those patterns into a modest, small framework revolving around just three main concepts: Controllers, actions, and targets. It’s designed to read as a progressive enhancement when you look at the HTML it’s addressing…

You should 💯 read the rest of this post as well as watch this proposition of Turbolinks from Sam Stephenson at RailsConf 2016. ALSO, we’re recording a show next week with David Heinemeier Hansson about Stimulus, so send us any questions you have by replying to this email, Slack, or Twitter.

Player art
  0:00 / 0:00