2 ms·
Someone posted this here a while back: https://github.com/1Marc/todomvc-vanillajs-2022/tree/main/js https://github.com/1Marc/todomvc-vanillajs-2022/tree/main/js
by CraigJPerry 4y ago
Someone posted this here a while back: https://github.com/1Marc/todomvc-vanillajs-2022/tree/main/js https://github.com/1Marc/todomvc-vanillajs-2022/tree/main/js - i bookmarked it because i thought it was well done
- jraph 4y agoVery interesting indeed. That's some food for thought. 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 https://svelte.dev/tutorial/writable-stores [2] https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event https://developer.mozilla.org/en-US/docs/Web/API/Window/stor...
- CraigJPerry 4y ago>> Does not trigger when modified from the same page I'm thinking that's the purpose of https://github.com/1Marc/todomvc-vanillajs-2022/blob/main/js/store.js#L25 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.