Saturday, June 7, 2025

ATV 0.2


While every cool kid across the planet is experimenting with vibe coding, I’ve been overhauling my pet project, ATV, from the ground up. It is now re-written—still in pure Vanilla JavaScript—but this time in nice modular ES6. This time around I’m a little proud of the code. 


ATV is a replacement for stimulus.js, same concept but done in a functional style. In my mind, the controller code reads much cleaner and DRYer. 


Actually I did “vibe code” one part, I must admit. As an experiment I wanted to know if GitHub CoPilot (the only AI I have access to) could write (from an English description and examples only) a recursive descent parser for me, in the style of Douglas Crockford. Surprisingly it came pretty close, although it was also very close to my own first draft.


Other than that, the new ATV is old-timey human coded JavaScript!  It does everything shown on the ATV By Examples page (https://www.sbrew.com/atv_by_example) and more with almost no changes from the 0.1 version.


Two changes to the API are improvements, plus one feature was removed until/if/when I hear someone wants it:

  1. Now actually pluralizes the groups of targets, so if you have five targets called puppy, you will get them via targets.puppies
  2. For actions with parameters, strings now must be quoted, like : data-atv-zoo-action: { "click->greet(‘puppy’)" }
  3. ATV no longer notifies if targets are removed or added to the page. I'd love to hear what the use case is for this and I can add it back!


Other features include:


  • Consists of 14 ES6 modules, the largest of which is 157 lines including comments
  • Gzips down to under 4KB.
  • Passes JSLint *and* ESLint, except for whitespace rules where I let ESLint win.
  • No “this”
  • No “classes”
  • Recursive descent parsing of actions