mirror of
https://github.com/LinoSchmidt/StickExporterTX.git
synced 2026-03-23 10:36:09 +01:00
Saving terminal state
This commit is contained in:
@@ -27,6 +27,7 @@ type JSONSettings = {
|
||||
profiles: JSONProfile[],
|
||||
logs: string[],
|
||||
output: string,
|
||||
showRenderTerminal: boolean
|
||||
}
|
||||
|
||||
const defaultSettings:JSONSettings = {
|
||||
@@ -42,7 +43,8 @@ const defaultSettings:JSONSettings = {
|
||||
}
|
||||
],
|
||||
logs: [],
|
||||
output: defaultOutputPath
|
||||
output: defaultOutputPath,
|
||||
showRenderTerminal: false
|
||||
};
|
||||
|
||||
function catchSetting(tryFunc:()=>string, catchFunc:()=>string) {
|
||||
@@ -126,7 +128,8 @@ const settingList = await fetch(SettingPath).then(function(response) {
|
||||
output: catchSetting(function() {return getXMLChild(xmlDoc, "output");},function() {
|
||||
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
||||
return defaultSettings.output;
|
||||
})
|
||||
}),
|
||||
showRenderTerminal: defaultSettings.showRenderTerminal
|
||||
} as JSONSettings;
|
||||
});
|
||||
}
|
||||
@@ -195,7 +198,15 @@ const settingList = await fetch(SettingPath).then(function(response) {
|
||||
output: catchSetting(function() {return parsedData.output;},function() {
|
||||
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
||||
return defaultSettings.output;
|
||||
})
|
||||
}),
|
||||
showRenderTerminal: function() {
|
||||
if(typeof parsedData.showRenderTerminal === "boolean") {
|
||||
return parsedData.showRenderTerminal;
|
||||
} else {
|
||||
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
|
||||
return defaultSettings.showRenderTerminal;
|
||||
}
|
||||
}()
|
||||
}
|
||||
});
|
||||
if(fetchFailed !== "") {
|
||||
@@ -332,6 +343,14 @@ function getInOutSettings() {
|
||||
return {logs: settingList.logs, output: settingList.output};
|
||||
}
|
||||
|
||||
function setShowRenderTerminal(show:boolean) {
|
||||
settingList.showRenderTerminal = show;
|
||||
writeSettings();
|
||||
}
|
||||
function getShowRenderTerminal() {
|
||||
return settingList.showRenderTerminal;
|
||||
}
|
||||
|
||||
function removeProfile(profileName?:string) {
|
||||
if(profileName === undefined) {
|
||||
profileName = getActiveProfile().profileName;
|
||||
@@ -498,6 +517,8 @@ export {
|
||||
getActiveProfile,
|
||||
setInOutSettings,
|
||||
getInOutSettings,
|
||||
setShowRenderTerminal,
|
||||
getShowRenderTerminal,
|
||||
getLogSize,
|
||||
importProfile,
|
||||
exportProfile,
|
||||
|
||||
Reference in New Issue
Block a user