repl icon indicating copy to clipboard operation
repl copied to clipboard

Use shared worker to avoid the warm up time when you open a new tab

Open alfonsogarciacaro opened this issue 7 years ago • 2 comments

Sometimes you need to use multiple tabs in the REPL when you're trying different things or opening multiple shared URLs. In those cases, it's a bit tedious to wait the 5-6 seconds every time until being able to use the REPL.

It shouldn't be too difficult to turn the current worker into a shared worker so it can be reused in multiple browser tabs. I'll look into this.

alfonsogarciacaro avatar Oct 19 '18 14:10 alfonsogarciacaro

We need to be careful about multi tab scenario because we are saving the code in the localstorage and so each tab is erasing each other.

Even with multiple workspace we will need to find a way to limit this problem. I think we can gain à unique id per tab to identify them.

MangelMaxime avatar Oct 19 '18 16:10 MangelMaxime

Using a unique id for each tab is a great idea! We should also add the timestamp so, in case there's nothing saved with that id, the REPL will load the most recent data (at this point we should start thinking about IndexedDb instead of localStorage).

Also my idea is that, as soon as users start to get serious with their work, they must set a project name, that will become the id when saving it.

alfonsogarciacaro avatar Oct 19 '18 22:10 alfonsogarciacaro