Re:The Failed Promise of Web Components
by isochronous on Wednesday September 30, 2020 @05:47PM
(#24644351)
Lit-HTML is a templating system that's baked into Lit-Element, which is basically the successor to the Polymer framework. It simply uses JS template strings, with a few little niceties in the binding syntax to allow for things like setting properties rather than attributes, adding/removing boolean attributes, and defining event handlers inline. It lacks two-way data binding, but we use "data" elements as a centralized data store. That store provides a master state object that's passed down to every component on the page - though frequently it's just a sub-tree of state that gets passed down. If a component receives some input and needs to update its state, it fires off an event with the updated value, which has a corresponding handler in the data element. That handler taps into a functional pipeline we've built to handle function composition, passes the information down the appropriate pipeline, and the master state is updated appropriately. At that point the data element fires a "state-changed" even that basically everything listens for, and whoever cares can then update their own little bit of state from the master store (typically one line of code).
Re:The Failed Promise of Web Components
by claytongulick on Thursday October 01, 2020 @01:58AM
(#24647817)
We do very similar things.
Works great.
Secondary languages are a bad idea, so hopefully this templating language would be something like jsx/ejs.
The proposal really is to bake applications support in to the browser. That seems right to me. The browser is more and more an os, and it should support rich applications out of the box.
React is derivative of windows application development, so there is precedent for something like it to be baked in to an OS.