Remove pageLoop

That functionality is now built in to the engine.
This commit is contained in:
phosit 2025-04-23 13:23:04 +02:00
parent 6ead0d2f92
commit 3d8971daca
No known key found for this signature in database
GPG key ID: C9430B600671C268
7 changed files with 16 additions and 34 deletions

View file

@ -301,24 +301,6 @@ function getBuildString()
});
}
/**
* Opens a page. If that page completes with an object with a @a nextPage
* property that page is opened with the @a args property of that object.
* That continues untill there is no @a nextPage property in the completion
* value. If there is no @a nextPage in the completion value the
* @a completionValue is returned.
* @param {String} page - The page first opened.
* @param args - passed to the first page opened.
*/
async function pageLoop(page, args)
{
let completionValue = { "nextPage": page, "args": args };
while (completionValue?.nextPage != null)
completionValue = await Engine.OpenChildPage(completionValue.nextPage, completionValue.args);
return completionValue;
}
function formatXmppAnnouncement(subject, text)
{
var message = "";

View file

@ -25,7 +25,7 @@ class CivInfoButton
async openPage(page)
{
this.civInfo = await pageLoop(page, this.civInfo.args);
this.civInfo = await Engine.OpenChildPage(page, this.civInfo.args);
}
}

View file

@ -47,7 +47,7 @@ export const mainMenuItems = [
"hotkey": "structree",
"onPress": () =>
{
pageLoop("page_structree.xml");
Engine.OpenChildPage("page_structree.xml");
}
},
{
@ -56,7 +56,7 @@ export const mainMenuItems = [
"hotkey": "civinfo",
"onPress": () =>
{
pageLoop("page_civinfo.xml");
Engine.OpenChildPage("page_civinfo.xml");
}
},
{

View file

@ -25,12 +25,12 @@ class CivInfoPage extends ReferencePage
switchToStructreePage()
{
this.closePageCallback({
"nextPage": "page_structree.xml",
"args": {
this.closePageCallback({ [Engine.openRequest] : {
"page": "page_structree.xml",
"argument": {
"civ": this.activeCiv
}
});
}});
}
closePage()

View file

@ -12,12 +12,12 @@ class CivInfoButton
onPress()
{
this.parentPage.closePageCallback({
"nextPage": "page_civinfo.xml",
"args": {
this.parentPage.closePageCallback({ [Engine.openRequest] : {
"page": "page_civinfo.xml",
"argument": {
"civ": this.parentPage.activeCiv
}
});
}});
}
}

View file

@ -12,12 +12,12 @@ class StructreeButton
onPress()
{
this.parentPage.closePageCallback({
"nextPage": "page_structree.xml",
"args": {
this.parentPage.closePageCallback({ [Engine.openRequest] : {
"page": "page_structree.xml",
"argument": {
"civ": this.parentPage.activeCiv
}
});
}});
}
}

View file

@ -34,7 +34,7 @@ class CivIcon
closeOpenDialogs();
g_PauseControl.implicitPause();
this.dialogSelection = await pageLoop(
this.dialogSelection = await Engine.OpenChildPage(
page,
{
// If an Observer triggers `openPage()` via hotkey, g_ViewedPlayer could be -1 or 0