-
Notifications
You must be signed in to change notification settings - Fork 7
Mirror playground script in URL hash #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Benchmark for 33728b4Click to view benchmark
|
This is definitely a great little thing to have! I see it's getting complicated to track what caused the script change. Also, when loading a URL with a hash I see the correct hashed script in the editor but when starting to play it's playing back the default script. So there's a Also wondering if the hash should only update when committing and not while editing. That might make change tracking easier, too. |
Benchmark for 47b3123Click to view benchmark
|
Fixed the issues. I think it's better to update the hash on all edits, the change needs to be tracked in both cases the same way unfortunately and to me it feels more straightforward if the hash simply mirrors whatever is in the editor at any moment, but it is easy to move this into the commit action if you want. |
Benchmark for fa2825bClick to view benchmark
|
That works great. I'd rebase this on dev and merge this as it is then. Or would you like to add something else here? |
I made it load the instrument from the hash as well, this way shared scripts might make more sense (we could also assign default instruments for the examples for variety). Also made the playback button a toggle, this saves space and better aligns with the editor shortcut (added a hint for that to the button tooltip). Tweaked the style a bit so that buttons change in look when pressed (before this, the hover and pressed styles were the same). Changed some of the style manipulation to toggling classes and descibing them in the css. Colored the scrollbar and toned down the list markers for a better look. Apologies for the additional changes squeezed into this PR but as touching this part is not much fun, it seemed best to implement these other improvements while I was at it. Btw, should I push the built |
d533d04
to
08a0465
Compare
Looks great and works, so I'm of course fine with it :)
I had added them to make it easier to test things locally. As the playground is hosted online, this no longer is necessary. I'll remove them... The app.js changes do not affect the playground.* files. Those only need to be rebuilt when the rust backend code or asset data changes. Likely they show up modified in your case, because you are using a different emscripten compiler version than I did when committing the files... |
A feature that is present on many livecoding sites, encoding the script you write into the URL hash using a base64 string as you type, so that it is easy to share a script by simply copy-pasting the link.
Wrapping the script into an object here so that created links stay future proof in case we want to add encoding more states like the default sample, parameter values or something else besides the script string later.
Overall, not the most elegant thing but it proved useful on other sites like this and it is easy to implement.