I think that's it. I wonder how far we could go with vanilla js + a dead simple central store implementation that would help update the UI at different places when a value changes.
You might end up re-inventing Svelte by attempting this though.
I think that's it. I wonder how far we could go with vanilla js + a dead simple central store implementation that would help update the UI at different places when a value changes.
You might end up re-inventing Svelte by attempting this though.
Though I should note that if this code has a "store.js" file, this is not the kind of store that I had in mind. More like the Svelte store [1], or Redux (which I find awfully complex).
I didn't know the "storage" event on Window [2] (which, for the record, triggers when localStorage is modified from another page. Does not trigger when modified from the same page, which makes localStorage not sufficient as-is to build the kind of store I'm referring to).
[1] https://svelte.dev/tutorial/writable-stores
[2] https://developer.mozilla.org/en-US/docs/Web/API/Window/stor...
I'm thinking that's the purpose of https://github.com/1Marc/todomvc-vanillajs-2022/blob/main/js... - without dispatching that custom save event, there wouldn't be a way to react at any other locations on the same page to the store updating.
https://github.com/numtel/democratic-capital/blob/master/src...
An example template:
https://github.com/numtel/democratic-capital/blob/master/src...
And then in the next breath make some joke about the proliferation of so many different js frameworks.
1000 hours later and 200k lines of code... I just built the next React/Vue/Svelte, now there's even more options to choose from, with same amount of bloat,just different because 'my way' is better than 'their way' - maybe.