Preform task before reset

So I want to be able to perform an auto-save in my game. But doing it every time my game updates will cause lag. In addition, I could use the “on game update every x second” but that means players will have to wait for it to happen before they can close out the tab. So, I thought maybe I could do it right before someone clicks reset. However, there is no function to do that. Is there an extension I could use to let me save the game before a reset and then reset when it’s finished?

I think it is easier to just do it the “cookie clicker way”, where it auto-saves every once in a while, but then provide a method to the user to save now. Similar to how I do it in Fossil Clicker:

(I was lucky enough to time the “Saved game successfully” notification hehe)

1 Like