To easily reason about a program one should be able to treat a function like a blackbox: It only has access to the arguments. It completes with a return-value or an exception. -> Structured Programming.
But when the function calls Engine.PopGuiPage it doens't complete with a return-value or an exception but it shuts down the whole ScriptInterface / page. Don't get me started on Engine.SwitchGuiPage which is as powerfull as goto.
Whith structured code exception work again. Exceptions can propagate to the parrent page. Error can't be serialized but they should.
Sometimes the page want's to do something before closing itself. Composing the return value or save some data. Previously one would have to do that in every place Engine.PopGuiPage is called or one has to call an intermediate function.
The init function of the page has to return a Promise. (async functions implicitly return a Promise) When the Promise is settlet the page gets closed. The value (or the exception / reason) of the Promise get's propagated to the parrent page.
Some pages never "return to the parrent page" (like the main menue) so they can return a promise that never settles: new Promise(() => {});
The easy way to adapt woud be to pass the resolver to where it will be called (likely a onPress function). As I did in the lobby and summary.
The much nicer way would be to rewrite the whole page to be an async function. As I did with SavegameLoader and SavegameWriter.