typescript-play icon indicating copy to clipboard operation
typescript-play copied to clipboard

Use localStorage

Open agentcooper opened this issue 6 years ago • 3 comments

Code should be saved to localStorage when closing playground.

agentcooper avatar Apr 09 '18 12:04 agentcooper

@agentcooper What do you think about persisting compiler options as well?

karol-majewski avatar May 03 '18 12:05 karol-majewski

@karol-majewski yes, this definitely should be done, however it becomes tricky with params coming from url (they probably should take precedence).

agentcooper avatar May 03 '18 12:05 agentcooper

I think the logic should go like this:

  1. If there's any URL parameter set, use that and skip the other step. However, do update this into the localStorage now.
  2. 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.

Airblader avatar Jan 18 '19 21:01 Airblader