Hacker News new | ask | show | jobs
by gliechtenstein 3291 days ago
Thank you! You are right about everything. It's intentionally built with es5, it was pretty challenging to do so. Initially I used es6 proxy to handle all the state synchronization and message dispatch without touching the DOM but since my main goal was to build something that works on ALL browsers today, without any transpiling, I instead used Object.defineProperty. It was tricky but got it to work!

Also yes it is component based but it's a different type of component than other frameworks. Since cell has no classes to inherit (to get rid of dependency) you can write the entire app with stateless functions only. This scales better than class based approaches since functions don't have overhead and you can "componentize" anything.

Hope this makes sense! I did my best to explain these on the homepage but if some of them are not clear enough please let me know, I'll correct them!

2 comments

Ah yeah I think, I read a bit more and the idea of using pure functions to generate the mostly-JSON spec is actually really neat. But how can you handle many events and complex custom side-effects without adding bigger and bigger functions to the mix? And then DOM elements will need a way to communicate with the other elements and share data. I suppose you could always add a message bus architecture like Redux or whatever, but [oh yeah I forgot I made this flux module thing for ES5! https://github.com/guscost/simple-flux/blob/master/sf.js]
Yes, cell itself has a decentralized architecture but that doesn't mean you need to do everything in a decentralized manner.

Just like you can build spaceships, police station, cars, and all kinds of complex things using lego blocks, you can build complex architecture using the simple building block that is cell.

I myself have been experimenting with different approaches of structuring apps using cell, and there are really a lot of different ways since we become free from having to inherit classes and instantiate objects from them. I don't want to be constraining about how one uses cell so I don't talk much about what a "best practice" is (yet)

But maybe sooner or later people can share some nice approaches for structuring "traditional apps" using cell

> Just like you can build spaceships, police station, cars, and all kinds of complex things using lego blocks, you can build complex architecture using the simple building block that is cell

Except you cannot have a hierarchy of cells without the top level cell having responsibility of the whole world below in its own scope: that doesn't scale well and limits complexity to maybe a couple of levels.

I think a message bus plus a bunch of autonomous mini-DOM element trees could be pretty cool. It might lead you to flatten the DOM too much for big apps though, not sure.

EDIT: Whoops, it's pretty trivial to nest components and describe a tree of HTML.

>It's intentionally built with es5

FYI your website fails to load in IE11 because the `fetch` function (polyfill?) uses `Promise`

sorry about that, yeah i meant to add fetch polyfill but forgot to.

But rest assured, the library itself is 100% es5.

btw could you share the link that's not working on IE11? I will fix it right away. Would appreciate it!