nartc / super-expressive-playground

SuperExpressive Playground
https://sepg.netlify.app
22 stars 5 forks source link

Stateful URL #7

Open james2doyle opened 3 years ago

james2doyle commented 3 years ago

It would be cool to add a stateful URL to the playground so that you can link directly to results already in the editor. I wrote one of these for Vues state management system (https://gist.github.com/james2doyle/67cddc077f67227981c2710abab66609) and it is pretty simple. You just encode the data you want and then decode it on page load.

You can see an example of this with the flems editor:

https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcIB08wgDQgDMBLGHVAbVADsBDAWwjUwAt46o8RYB7KxPpiAC+uavUbosOfDz4QB6APQAqZQB0qAAmWaAwgCcINRJpqaAquYCSAEQ3bNAAUgRNreAAdUixWHg1YAGtuADcIfQIobgB3DB46RRpFAA5kgAYATgAWAHYAJkUARlS8rIA2e3UtHUdDeABXfS1gP30iKgBzIUrFDQJ6qgQiXk06GkCIc3qiJAAKAEpUTVb2js1ge00fTQBPbkbNAhoQ-baTDumkTQ75cONhrX7B+AfNHnqoK47uN3CITe2EAAHkt3F4fH4AsEwhEorF4okUulsvkiiVypsYPBNFcALyaKgQaKaGzGCALDA3eAAFSIDAWmgA1JpZtF2kgYhgPOECNx9GNBq4AD5Cklk+YYKgxBYAbg0mzqjS0AHIgWr1WqALQazVZdWanb6jXG9XKjCGDxQALkxTkIE7AC6ig6uBZsHmmlxAD51ptNG9eH5NPpPSyrsyALLGZjmmhUDl0Bk6QplD0AUk0Kc0orScq0-pxoaj8BjkW4fNmV0UmdTeb9wYgDSabs9uPxquVmgA-MHNEtZiGAGSaNJAgDM2ZHQOS8wl8G4AGV4G1OrMU-M8-6hBuNN0qBpZGBuDAMFEOrMxhMpjMFhvOPEPCRwkxsJxIDAhoGmCnUABWYSiCAtAMEwcRgNIXC8Pw8CCEIDpCEAA

What do you think?

nartc commented 3 years ago

@james2doyle Something like TypeScript playground right?

james2doyle commented 3 years ago

Yeah exactly! It would personally help me save old examples and even share new ones with my team

nartc commented 3 years ago

Thanks for the gist. I'll look into it as soon as I find sometimes. Maybe it'd be worth it to also incorporating Bitly API for shortening URL for sharing/storing purposes. Feel free to submit a PR if you'd like.