3 ms·
You could store all state in the URL fragment. Maybe each key is a sound and each value is the volume, like /#whale=5&fire=8 or whatever. Call replaceState (bet
by hunter2_ 3y ago
You could store all state in the URL fragment. Maybe each key is a sound and each value is the volume, like /#whale=5&fire=8 or whatever. Call replaceState (better than pushState to avoid polluting the back button history with every little tweak) whenever the user changes something. On page load, read from the URL fragment using window.location.hash and then sharing is just a matter of copying the URL, which could be done entirely in browser chrome, and/or via a "share" button you provide.
These might help:
https://www.jvt.me/posts/2019/08/01/node-parse-url-fragment/ https://www.jvt.me/posts/2019/08/01/node-parse-url-fragment/
https://stackoverflow.com/a/66416539 https://stackoverflow.com/a/66416539
- catapart 3y agoGreat recommendation for such simple state! The portability of that is just perfect!
- matteason 3y agoThis is exactly what I do on https://www.matteason.co.uk/scotbeats/ https://www.matteason.co.uk/scotbeats/ actually - any settings change is reflected in the URL and read back on load. When I implement sharing of individual mixes it'll probably look a lot like this