My use case is as follows:
- User should be able to create multiple three js scenes in tabs.
- If they are switching tabs the progress of these scenes should stay the same (autosave probably). I don’t need an undo/ redo
- Once they hit a SAVE button these scenes should be saved (to a sever) so that these can be downloaded/ accessed at a later time.
I have been exploring how it’s been done in the
editor https://threejs.org/editor/ and some other related posts. But my question is more on the best practices side.
Alternatives of achieving the #1 and #2 objectives might be
- For each tab I have a separate scene (and its file) as what editor has in a way, which I load and keep updated as user make changes in these different files explicitly made for separate tabs.
- I have only one scene and once a user switches tab, I save that scene into JSON (or other format); then remove everything from the scene, so that it can be used anew. Same sequence of events whenever tabs are switched.
Going deeper, there are two alternatives in each of these:
- I save the scene to a server and reload whenever it is required to be.
- I use either local storage or indexedDB to save the scene.
I might not have the knowledge of other alternatives, pardon me for that. Hence, please feel free to let me know if there is a more performant way to achieve my objective and what should be the preferred approach as per current
threejs dev branch codebase and the alternatives given above and your experiences.