typescript-play
typescript-play copied to clipboard
Use localStorage
Code should be saved to localStorage when closing playground.
@agentcooper What do you think about persisting compiler options as well?
@karol-majewski yes, this definitely should be done, however it becomes tricky with params coming from url (they probably should take precedence).
I think the logic should go like this:
- If there's any URL parameter set, use that and skip the other step. However, do update this into the localStorage now.
- Otherwise, restore from localStorage and update the URL to reflect the now loaded state.
I wouldn't mix localStorage with URL parameters in cases where a single parameter isn't set. It's very unlikely that that's what a user would expect.