-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Is your feature request related to a problem? Please describe.
Every time bullschcript.js changes, it hot-reloads (awesome), but in doing so removes scene information.
This information should be automatically reinitialized when this happens for a cleaner dev experience.
Describe the solution you'd like
Right now I have the following methods in place:
var loadLocalUserSceneFromLocalStorage = (scene)=>{
var luser = JSON.parse(localStorage.getItem("localUser"));
if(luser){
scene.localUser = luser
scene.users = {
[luser.uid]: luser
}
}
}
var saveLocalUserSceneToLocalStorage = (luser)=>{
localStorage.setItem("localUser", JSON.stringify({
"name": luser.name,
"uid": luser.uid,
"isLocal": luser.isLocal,
"color": luser.color
}));
}
...
scene.On("loaded", async () => {
if(scene.localUser === undefined){
loadLocalUserSceneFromLocalStorage(scene);
}else{
saveLocalUserSceneToLocalStorage(scene.localUser);
}
})
Having to include this in every project isn't that big a deal, but we should strive for consistent, predictable runtime behavior.