I can’t find a save button, and as a result when I refresh my save files get trashed

The Nightfly

Today at 11:19 AM
Hello! I just learned about this project today, looks awesome! I have the server running on my machine and am connecting via the browser. I can’t find a save button, and as a result when I refresh my save files get trashed. Any hints?
Crappyrules Ⓤ

Today at 1:29 PM
You should save game inside game itself
And before closing browser call to persist
js-dos supports saving and restoring game progress. You can play game from time to time
caiiiycuk
The Nightfly

Today at 1:51 PM
Thanks, is there an easy way to add a save button to the chrome? I did see this api, but wasn’t sure the right way to invoke it.
caiiiycuk

Today at 2:03 PM
When you create Dos provide the onExit function, then player will start with close button that will call persist
I think I need to update docs here
And keep this close button visible no matter if you provide onExit or not
Do it like this :

const dos = Dos(root, {
        onExit: () => {
        },
    });

The Nightfly

Today at 2:20 PM
yep, that indeed did it, thanks
caiiiycuk

Today at 2:32 PM
If you provide client Id then saves also will be stored in cloud not only in browser

Dos(<element>, {
        clientId: (userGesture) => {
            if (!userGesture) {
                return Promise.resolve(null); // <-- return cached { namespace, id } or null
            }

            return Promise.resolve({
                namespace: "test", // <-- your namespace
                id: "client", // <-- some id of user
            })
        }
    }).run(<bundleUrl>);

The Nightfly

Today at 2:34 PM
Does namespace matter?
caiiiycuk

Today at 2:47 PM
Yep, you should provide something
Any
This needed to avoid name clashing between different integrations