3 ms·
The web components under the hood would still need a way to program themselves in response to that data, so a templating language would need to be baked in alon
by nkingsy 6y ago
The web components under the hood would still need a way to program themselves in response to that data, so a templating language would need to be baked in along with data binding.
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.
- isochronous 6y agoLit-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).
- claytongulick 6y agoWe do very similar things. Works great.