News for hackers. Stuff that matters.
Re:Snabbdom – A Simple, Modular, Powerful, and Fast Virtual ... by maattdd on Sunday July 17, 2016 @09:53AM (#12110167)
I really like this library. I've used it to implement a minimal React+Redux toy "framework" when I was spending hours in cranky trains in India.

It turns out in 200 lines of TypeScript I can have a view library which has everything I like from React/Redux/mithril/Elm:

* reactive (hopefully fast, I haven't benchmark anything but I trust snabbdom benchmarks)

* simple API (basically 2 functions) and simple workflow (event -> update -> render)

* hot-reloadable (thanks to Webpack HMR)

* time-travelable (inspirated by Elm Reactor)

* type safe-ish (I wish I could do more here but I think TS is limiting it - a const keyword would be awesome)

Disclaimer: I wrote that during my Asia backpacking so the code is ugly and not even named consistenly but as I'm looking for a job I will try to make it more presentable/usable soon. https://github.com/maattdd/AuberJS for those interested

Random interesting bits:

  function draw() {
    if (m && node) {
        const new_node = ballastView(r,m)
        patch(node,new_node)
        node = new_node
    } else {
        console.error("Unable to draw")
    }
  }

There are no comments on this comment yet.