Simplified TabWaiter structure

This commit is contained in:
n1474335 2022-10-21 13:57:46 +01:00
parent 01508a2459
commit 5efd125d9b
7 changed files with 58 additions and 233 deletions

View File

@ -156,7 +156,7 @@ class App {
this.manager.input.inputWorker.postMessage({
action: "autobake",
data: {
activeTab: this.manager.tabs.getActiveInputTab()
activeTab: this.manager.tabs.getActiveTab("input")
}
});
} else {
@ -174,7 +174,7 @@ class App {
// Reset status using cancelBake
this.manager.worker.cancelBake(true, false);
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
if (activeTab === -1) return;
let progress = 0;
@ -221,7 +221,7 @@ class App {
setInput(input) {
// Get the currently active tab.
// If there isn't one, assume there are no inputs so use inputNum of 1
let inputNum = this.manager.tabs.getActiveInputTab();
let inputNum = this.manager.tabs.getActiveTab("input");
if (inputNum === -1) inputNum = 1;
this.manager.input.updateInputValue(inputNum, input);

View File

@ -126,7 +126,7 @@ class BindingsWaiter {
break;
case "KeyW": // Close tab
e.preventDefault();
this.manager.input.removeInput(this.manager.tabs.getActiveInputTab());
this.manager.input.removeInput(this.manager.tabs.getActiveTab("input"));
break;
case "ArrowLeft": // Go to previous tab
e.preventDefault();

View File

@ -83,7 +83,7 @@ class HighlighterWaiter {
*/
displayHighlights(pos, direction) {
if (!pos) return;
if (this.manager.tabs.getActiveInputTab() !== this.manager.tabs.getActiveOutputTab()) return;
if (this.manager.tabs.getActiveTab("input") !== this.manager.tabs.getActiveTab("output")) return;
const io = direction === "forward" ? "output" : "input";
this.highlight(io, pos);

View File

@ -208,7 +208,7 @@ class InputWaiter {
action: "updateMaxTabs",
data: {
maxTabs: numTabs,
activeTab: this.manager.tabs.getActiveInputTab()
activeTab: this.manager.tabs.getActiveTab("input")
}
});
}
@ -237,7 +237,7 @@ class InputWaiter {
action: "updateMaxTabs",
data: {
maxTabs: this.maxTabs,
activeTab: this.manager.tabs.getActiveInputTab()
activeTab: this.manager.tabs.getActiveTab("input")
}
});
this.inputWorker.postMessage({
@ -357,7 +357,7 @@ class InputWaiter {
if (Object.prototype.hasOwnProperty.call(r, "progress") &&
Object.prototype.hasOwnProperty.call(r, "inputNum")) {
this.manager.tabs.updateInputTabProgress(r.inputNum, r.progress, 100);
this.manager.tabs.updateTabProgress(r.inputNum, r.progress, 100, "input");
}
const transferable = Object.prototype.hasOwnProperty.call(r, "fileBuffer") ? [r.fileBuffer] : undefined;
@ -400,7 +400,7 @@ class InputWaiter {
this.changeTab(r.data, this.app.options.syncTabs);
break;
case "updateTabHeader":
this.manager.tabs.updateInputTabHeader(r.data.inputNum, r.data.input);
this.manager.tabs.updateTabHeader(r.data.inputNum, r.data.input, "input");
break;
case "loadingInfo":
this.showLoadingInfo(r.data, true);
@ -473,7 +473,7 @@ class InputWaiter {
*/
async set(inputNum, inputData, silent=false) {
return new Promise(function(resolve, reject) {
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
if (inputNum !== activeTab) return;
if (inputData.file) {
@ -519,7 +519,7 @@ class InputWaiter {
* @param {number} progress
*/
setFile(inputNum, inputData) {
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
if (inputNum !== activeTab) return;
// Create file details panel
@ -542,7 +542,7 @@ class InputWaiter {
* @param {number} inputNum
*/
clearFile(inputNum) {
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
if (inputNum !== activeTab) return;
// Clear file details panel
@ -557,9 +557,9 @@ class InputWaiter {
* @param {number} inputNum - The inputNum of the input which has finished loading
*/
fileLoaded(inputNum) {
this.manager.tabs.updateInputTabProgress(inputNum, 100, 100);
this.manager.tabs.updateTabProgress(inputNum, 100, 100, "input");
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
if (activeTab !== inputNum) return;
this.inputWorker.postMessage({
@ -580,7 +580,7 @@ class InputWaiter {
* @param {number | string} progress - Either a number or "error"
*/
updateFileProgress(inputNum, progress) {
// const activeTab = this.manager.tabs.getActiveInputTab();
// const activeTab = this.manager.tabs.getActiveTab("input");
// if (inputNum !== activeTab) return;
// TODO
@ -727,10 +727,10 @@ class InputWaiter {
inputChange(e) {
debounce(function(e) {
const value = this.getInput();
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
this.updateInputValue(activeTab, value);
this.manager.tabs.updateInputTabHeader(activeTab, value.slice(0, 100).replace(/[\n\r]/g, ""));
this.manager.tabs.updateTabHeader(activeTab, value.slice(0, 100).replace(/[\n\r]/g, ""), "input");
// Fire the statechange event as the input has been modified
window.dispatchEvent(this.manager.statechange);
@ -813,7 +813,7 @@ class InputWaiter {
*/
loadUIFiles(files) {
const numFiles = files.length;
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
log.debug(`Loading ${numFiles} files.`);
// Display the number of files as pending so the user
@ -912,7 +912,7 @@ class InputWaiter {
setTimeout(function() {
this.inputWorker.postMessage({
action: "getLoadProgress",
data: this.manager.tabs.getActiveInputTab()
data: this.manager.tabs.getActiveTab("input")
});
}.bind(this), 100);
}
@ -925,8 +925,8 @@ class InputWaiter {
* @param {boolean} [changeOutput=false] - If true, also changes the output
*/
changeTab(inputNum, changeOutput) {
if (this.manager.tabs.getInputTabItem(inputNum) !== null) {
this.manager.tabs.changeInputTab(inputNum);
if (this.manager.tabs.getTabItem(inputNum, "input") !== null) {
this.manager.tabs.changeTab(inputNum, "input");
this.inputWorker.postMessage({
action: "setInput",
data: {
@ -935,7 +935,7 @@ class InputWaiter {
}
});
} else {
const minNum = Math.min(...this.manager.tabs.getInputTabList());
const minNum = Math.min(...this.manager.tabs.getTabList("input"));
let direction = "right";
if (inputNum < minNum) {
direction = "left";
@ -1070,8 +1070,8 @@ class InputWaiter {
const tabsWrapper = document.getElementById("input-tabs"),
numTabs = tabsWrapper.children.length;
if (!this.manager.tabs.getInputTabItem(inputNum) && numTabs < this.maxTabs) {
const newTab = this.manager.tabs.createInputTabElement(inputNum, changeTab);
if (!this.manager.tabs.getTabItem(inputNum, "input") && numTabs < this.maxTabs) {
const newTab = this.manager.tabs.createTabElement(inputNum, changeTab, "input");
tabsWrapper.appendChild(newTab);
if (numTabs > 0) {
@ -1101,7 +1101,7 @@ class InputWaiter {
* @param {boolean} tabsRight - True if there are input tabs to the right of the displayed tabs
*/
refreshTabs(nums, activeTab, tabsLeft, tabsRight) {
this.manager.tabs.refreshInputTabs(nums, activeTab, tabsLeft, tabsRight);
this.manager.tabs.refreshTabs(nums, activeTab, tabsLeft, tabsRight, "input");
this.inputWorker.postMessage({
action: "setInput",
@ -1120,7 +1120,7 @@ class InputWaiter {
*/
removeInput(inputNum) {
let refresh = false;
if (this.manager.tabs.getInputTabItem(inputNum) !== null) {
if (this.manager.tabs.getTabItem(inputNum, "input") !== null) {
refresh = true;
}
this.inputWorker.postMessage({
@ -1213,7 +1213,7 @@ class InputWaiter {
* Changes to the next (right) tab
*/
changeTabRight() {
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
if (activeTab === -1) return;
this.inputWorker.postMessage({
action: "changeTabRight",
@ -1227,7 +1227,7 @@ class InputWaiter {
* Changes to the previous (left) tab
*/
changeTabLeft() {
const activeTab = this.manager.tabs.getActiveInputTab();
const activeTab = this.manager.tabs.getActiveTab("input");
if (activeTab === -1) return;
this.inputWorker.postMessage({
action: "changeTabLeft",
@ -1242,7 +1242,7 @@ class InputWaiter {
*/
async goToTab() {
const inputNums = await this.getInputNums();
let tabNum = window.prompt(`Enter tab number (${inputNums.min} - ${inputNums.max}):`, this.manager.tabs.getActiveInputTab().toString());
let tabNum = window.prompt(`Enter tab number (${inputNums.min} - ${inputNums.max}):`, this.manager.tabs.getActiveTab("input").toString());
if (tabNum === null) return;
tabNum = parseInt(tabNum, 10);

View File

@ -273,7 +273,7 @@ class OutputWaiter {
const numTabs = this.manager.tabs.calcMaxTabs();
if (numTabs !== this.maxTabs) {
this.maxTabs = numTabs;
this.refreshTabs(this.manager.tabs.getActiveOutputTab(), "right");
this.refreshTabs(this.manager.tabs.getActiveTab("output"), "right");
}
}
@ -351,7 +351,7 @@ class OutputWaiter {
this.outputs[inputNum].data = data;
const tabItem = this.manager.tabs.getOutputTabItem(inputNum);
const tabItem = this.manager.tabs.getTabItem(inputNum, "output");
if (tabItem) tabItem.style.background = "";
if (set) this.set(inputNum);
@ -431,7 +431,7 @@ class OutputWaiter {
this.outputs[inputNum].progress = progress;
if (progress !== false) {
this.manager.tabs.updateOutputTabProgress(inputNum, progress, total);
this.manager.tabs.updateTabProgress(inputNum, progress, total, "output");
}
}
@ -470,7 +470,7 @@ class OutputWaiter {
*/
async set(inputNum) {
inputNum = parseInt(inputNum, 10);
if (inputNum !== this.manager.tabs.getActiveOutputTab() ||
if (inputNum !== this.manager.tabs.getActiveTab("output") ||
!this.outputExists(inputNum)) return;
this.toggleLoader(true);
@ -565,7 +565,7 @@ class OutputWaiter {
* @param {number} activeTab
*/
setFile(buf, activeTab) {
if (activeTab !== this.manager.tabs.getActiveOutputTab()) return;
if (activeTab !== this.manager.tabs.getActiveTab("output")) return;
// Display file overlay in output area with details
const fileOverlay = document.getElementById("output-file"),
fileSize = document.getElementById("output-file-size"),
@ -694,7 +694,7 @@ class OutputWaiter {
* Handler for file download events.
*/
async downloadFile() {
const dish = this.getOutputDish(this.manager.tabs.getActiveOutputTab());
const dish = this.getOutputDish(this.manager.tabs.getActiveTab("output"));
if (dish === null) {
this.app.alert("Could not find any output data to download. Has this output been baked?", 3000);
return;
@ -849,9 +849,9 @@ class OutputWaiter {
const tabsWrapper = document.getElementById("output-tabs");
const numTabs = tabsWrapper.children.length;
if (!this.manager.tabs.getOutputTabItem(inputNum) && numTabs < this.maxTabs) {
if (!this.manager.tabs.getTabItem(inputNum, "output") && numTabs < this.maxTabs) {
// Create a new tab element
const newTab = this.manager.tabs.createOutputTabElement(inputNum, changeTab);
const newTab = this.manager.tabs.reateTabElement(inputNum, changeTab, "output");
tabsWrapper.appendChild(newTab);
} else if (numTabs === this.maxTabs) {
// Can't create a new tab
@ -873,11 +873,11 @@ class OutputWaiter {
*/
changeTab(inputNum, changeInput = false) {
if (!this.outputExists(inputNum)) return;
const currentNum = this.manager.tabs.getActiveOutputTab();
const currentNum = this.manager.tabs.getActiveTab("output");
this.hideMagicButton();
if (!this.manager.tabs.changeOutputTab(inputNum)) {
if (!this.manager.tabs.changeTab(inputNum, "output")) {
let direction = "right";
if (currentNum > inputNum) {
direction = "left";
@ -887,7 +887,7 @@ class OutputWaiter {
const tabsLeft = (newOutputs[0] !== this.getSmallestInputNum());
const tabsRight = (newOutputs[newOutputs.length - 1] !== this.getLargestInputNum());
this.manager.tabs.refreshOutputTabs(newOutputs, inputNum, tabsLeft, tabsRight);
this.manager.tabs.refreshTabs(newOutputs, inputNum, tabsLeft, tabsRight, "output");
for (let i = 0; i < newOutputs.length; i++) {
this.displayTabInfo(newOutputs[i]);
@ -977,7 +977,7 @@ class OutputWaiter {
* Handler for changing to the left tab
*/
changeTabLeft() {
const currentTab = this.manager.tabs.getActiveOutputTab();
const currentTab = this.manager.tabs.getActiveTab("output");
this.changeTab(this.getPreviousInputNum(currentTab), this.app.options.syncTabs);
}
@ -985,7 +985,7 @@ class OutputWaiter {
* Handler for changing to the right tab
*/
changeTabRight() {
const currentTab = this.manager.tabs.getActiveOutputTab();
const currentTab = this.manager.tabs.getActiveTab("output");
this.changeTab(this.getNextInputNum(currentTab), this.app.options.syncTabs);
}
@ -996,7 +996,7 @@ class OutputWaiter {
const min = this.getSmallestInputNum(),
max = this.getLargestInputNum();
let tabNum = window.prompt(`Enter tab number (${min} - ${max}):`, this.manager.tabs.getActiveOutputTab().toString());
let tabNum = window.prompt(`Enter tab number (${min} - ${max}):`, this.manager.tabs.getActiveTab("output").toString());
if (tabNum === null) return;
tabNum = parseInt(tabNum, 10);
@ -1115,7 +1115,7 @@ class OutputWaiter {
removeTab(inputNum) {
if (!this.outputExists(inputNum)) return;
const tabElement = this.manager.tabs.getOutputTabItem(inputNum);
const tabElement = this.manager.tabs.getTabItem(inputNum, "output");
this.removeOutput(inputNum);
@ -1134,7 +1134,7 @@ class OutputWaiter {
tabsLeft = (newNums[0] !== this.getSmallestInputNum() && newNums.length > 0),
tabsRight = (newNums[newNums.length - 1] !== this.getLargestInputNum() && newNums.length > 0);
this.manager.tabs.refreshOutputTabs(newNums, activeTab, tabsLeft, tabsRight);
this.manager.tabs.refreshTabs(newNums, activeTab, tabsLeft, tabsRight, "output");
for (let i = 0; i < newNums.length; i++) {
this.displayTabInfo(newNums[i]);
@ -1158,12 +1158,12 @@ class OutputWaiter {
tabStr = await this.getDishTitle(this.getOutputDish(inputNum), 100);
tabStr = tabStr.replace(/[\n\r]/g, "");
}
this.manager.tabs.updateOutputTabHeader(inputNum, tabStr);
this.manager.tabs.updateTabHeader(inputNum, tabStr, "output");
if (this.manager.worker.recipeConfig !== undefined) {
this.manager.tabs.updateOutputTabProgress(inputNum, this.outputs[inputNum].progress, this.manager.worker.recipeConfig.length);
this.manager.tabs.updateTabProgress(inputNum, this.outputs[inputNum].progress, this.manager.worker.recipeConfig.length, "output");
}
const tabItem = this.manager.tabs.getOutputTabItem(inputNum);
const tabItem = this.manager.tabs.getTabItem(inputNum, "output");
if (tabItem) {
if (this.outputs[inputNum].status === "error") {
tabItem.style.color = "#FF0000";
@ -1178,7 +1178,7 @@ class OutputWaiter {
*/
async backgroundMagic() {
this.hideMagicButton();
const dish = this.getOutputDish(this.manager.tabs.getActiveOutputTab());
const dish = this.getOutputDish(this.manager.tabs.getActiveTab("output"));
if (!this.app.options.autoMagic || dish === null) return;
const buffer = await this.getDishBuffer(dish);
const sample = buffer.slice(0, 1000) || "";
@ -1268,7 +1268,7 @@ class OutputWaiter {
sliceToEl = document.getElementById("output-file-slice-to"),
sliceFrom = parseInt(sliceFromEl.value, 10) * 1024,
sliceTo = parseInt(sliceToEl.value, 10) * 1024,
output = this.outputs[this.manager.tabs.getActiveOutputTab()].data;
output = this.outputs[this.manager.tabs.getActiveTab("output")].data;
let str;
if (output.type === "ArrayBuffer") {
@ -1296,7 +1296,7 @@ class OutputWaiter {
this.toggleLoader(true);
const outputFile = document.getElementById("output-file"),
showFileOverlay = document.getElementById("show-file-overlay"),
output = this.outputs[this.manager.tabs.getActiveOutputTab()].data;
output = this.outputs[this.manager.tabs.getActiveTab("output")].data;
let str;
if (output.type === "ArrayBuffer") {
@ -1326,7 +1326,7 @@ class OutputWaiter {
this.outputTextEl.classList.add("blur");
showFileOverlay.style.display = "none";
this.set(this.manager.tabs.getActiveOutputTab());
this.set(this.manager.tabs.getActiveTab("output"));
}
/**
@ -1352,7 +1352,7 @@ class OutputWaiter {
* Copies the output to the clipboard
*/
async copyClick() { // TODO - do we need this?
const dish = this.getOutputDish(this.manager.tabs.getActiveOutputTab());
const dish = this.getOutputDish(this.manager.tabs.getActiveTab("output"));
if (dish === null) {
this.app.alert("Could not find data to copy. Has this output been baked yet?", 3000);
return;
@ -1373,7 +1373,7 @@ class OutputWaiter {
* Moves the current output into the input textarea.
*/
async switchClick() {
const activeTab = this.manager.tabs.getActiveOutputTab();
const activeTab = this.manager.tabs.getActiveTab("output");
const switchButton = document.getElementById("switch");
switchButton.classList.add("spin");

View File

@ -48,24 +48,6 @@ class TabWaiter {
return -1;
}
/**
* Gets the currently active input tab number
*
* @returns {number}
*/
getActiveInputTab() {
return this.getActiveTab("input");
}
/**
* Gets the currently active output tab number
*
* @returns {number}
*/
getActiveOutputTab() {
return this.getActiveTab("output");
}
/**
* Gets the li element for the tab of a given input number
*
@ -83,26 +65,6 @@ class TabWaiter {
return null;
}
/**
* Gets the li element for an input tab of the given input number
*
* @param {inputNum} - The inputNum of the tab we're trying to get
* @returns {Element}
*/
getInputTabItem(inputNum) {
return this.getTabItem(inputNum, "input");
}
/**
* Gets the li element for an output tab of the given input number
*
* @param {number} inputNum
* @returns {Element}
*/
getOutputTabItem(inputNum) {
return this.getTabItem(inputNum, "output");
}
/**
* Gets a list of tab numbers for the currently displayed tabs
*
@ -120,24 +82,6 @@ class TabWaiter {
return nums;
}
/**
* Gets a list of tab numbers for the currently displayed input tabs
*
* @returns {number[]}
*/
getInputTabList() {
return this.getTabList("input");
}
/**
* Gets a list of tab numbers for the currently displayed output tabs
*
* @returns {number[]}
*/
getOutputTabList() {
return this.getTabList("output");
}
/**
* Creates a new tab element for the tab bar
*
@ -154,11 +98,8 @@ class TabWaiter {
const newTabContent = document.createElement("div");
newTabContent.classList.add(`${io}-tab-content`);
newTabContent.innerText = `Tab ${inputNum.toString()}`;
newTabContent.addEventListener("wheel", this.manager[io].scrollTab.bind(this.manager[io]), {passive: false});
newTab.appendChild(newTabContent);
if (io === "input") {
@ -166,52 +107,24 @@ class TabWaiter {
newTabButtonIcon = document.createElement("i");
newTabButton.type = "button";
newTabButton.className = "btn btn-primary bmd-btn-icon btn-close-tab";
newTabButtonIcon.classList.add("material-icons");
newTabButtonIcon.innerText = "clear";
newTabButton.appendChild(newTabButtonIcon);
newTabButton.addEventListener("click", this.manager.input.removeTabClick.bind(this.manager.input));
newTab.appendChild(newTabButton);
}
return newTab;
}
/**
* Creates a new tab element for the input tab bar
*
* @param {number} inputNum - The inputNum of the new input tab
* @param {boolean} [active=false] - If true, sets the tab to active
* @returns {Element}
*/
createInputTabElement(inputNum, active=false) {
return this.createTabElement(inputNum, active, "input");
}
/**
* Creates a new tab element for the output tab bar
*
* @param {number} inputNum - The inputNum of the new output tab
* @param {boolean} [active=false] - If true, sets the tab to active
* @returns {Element}
*/
createOutputTabElement(inputNum, active=false) {
return this.createTabElement(inputNum, active, "output");
}
/**
* Displays the tab bar for both the input and output
*/
showTabBar() {
document.getElementById("input-tabs-wrapper").style.display = "block";
document.getElementById("output-tabs-wrapper").style.display = "block";
document.getElementById("input-wrapper").classList.add("show-tabs");
document.getElementById("output-wrapper").classList.add("show-tabs");
document.getElementById("save-all-to-file").style.display = "inline-block";
}
@ -221,10 +134,8 @@ class TabWaiter {
hideTabBar() {
document.getElementById("input-tabs-wrapper").style.display = "none";
document.getElementById("output-tabs-wrapper").style.display = "none";
document.getElementById("input-wrapper").classList.remove("show-tabs");
document.getElementById("output-wrapper").classList.remove("show-tabs");
document.getElementById("save-all-to-file").style.display = "none";
}
@ -271,30 +182,6 @@ class TabWaiter {
}
}
/**
* Refreshes the input tabs, and changes to activeTab
*
* @param {number[]} nums - The inputNums to be displayed as tabs
* @param {number} activeTab - The tab to change to
* @param {boolean} tabsLeft - True if there are input tabs to the left of the displayed tabs
* @param {boolean} tabsRight - True if there are input tabs to the right of the displayed tabs
*/
refreshInputTabs(nums, activeTab, tabsLeft, tabsRight) {
this.refreshTabs(nums, activeTab, tabsLeft, tabsRight, "input");
}
/**
* Refreshes the output tabs, and changes to activeTab
*
* @param {number[]} nums - The inputNums to be displayed as tabs
* @param {number} activeTab - The tab to change to
* @param {boolean} tabsLeft - True if there are output tabs to the left of the displayed tabs
* @param {boolean} tabsRight - True if there are output tabs to the right of the displayed tabs
*/
refreshOutputTabs(nums, activeTab, tabsLeft, tabsRight) {
this.refreshTabs(nums, activeTab, tabsLeft, tabsRight, "output");
}
/**
* Changes the active tab to a different tab
*
@ -319,26 +206,6 @@ class TabWaiter {
return found;
}
/**
* Changes the active input tab to a different tab
*
* @param {number} inputNum
* @returns {boolean} - False if the tab is not currently being displayed
*/
changeInputTab(inputNum) {
return this.changeTab(inputNum, "input");
}
/**
* Changes the active output tab to a different tab
*
* @param {number} inputNum
* @returns {boolean} - False if the tab is not currently being displayed
*/
changeOutputTab(inputNum) {
return this.changeTab(inputNum, "output");
}
/**
* Updates the tab header to display a preview of the tab contents
*
@ -358,26 +225,6 @@ class TabWaiter {
tab.firstElementChild.innerText = headerData;
}
/**
* Updates the input tab header to display a preview of the tab contents
*
* @param {number} inputNum - The inputNum of the tab to update the header of
* @param {string} data - The data to display in the tab header
*/
updateInputTabHeader(inputNum, data) {
this.updateTabHeader(inputNum, data, "input");
}
/**
* Updates the output tab header to display a preview of the tab contents
*
* @param {number} inputNum - The inputNum of the tab to update the header of
* @param {string} data - The data to display in the tab header
*/
updateOutputTabHeader(inputNum, data) {
this.updateTabHeader(inputNum, data, "output");
}
/**
* Updates the tab background to display the progress of the current tab
*
@ -398,28 +245,6 @@ class TabWaiter {
}
}
/**
* Updates the input tab background to display its progress
*
* @param {number} inputNum
* @param {number} progress
* @param {number} total
*/
updateInputTabProgress(inputNum, progress, total) {
this.updateTabProgress(inputNum, progress, total, "input");
}
/**
* Updates the output tab background to display its progress
*
* @param {number} inputNum
* @param {number} progress
* @param {number} total
*/
updateOutputTabProgress(inputNum, progress, total) {
this.updateTabProgress(inputNum, progress, total, "output");
}
}
export default TabWaiter;

View File

@ -266,7 +266,7 @@ class WorkerWaiter {
if (progress !== false) {
this.manager.output.updateOutputStatus("error", inputNum);
if (inputNum === this.manager.tabs.getActiveInputTab()) {
if (inputNum === this.manager.tabs.getActiveTab("input")) {
this.manager.recipe.updateBreakpointIndicator(progress);
}
@ -335,16 +335,16 @@ class WorkerWaiter {
this.manager.output.updateOutputStatus("inactive", this.inputNums[i]);
}
const tabList = this.manager.tabs.getOutputTabList();
const tabList = this.manager.tabs.getTabList("output");
for (let i = 0; i < tabList.length; i++) {
this.manager.tabs.getOutputTabItem(tabList[i]).style.background = "";
this.manager.tabs.getTabItem(tabList[i], "output").style.background = "";
}
this.inputs = [];
this.inputNums = [];
this.totalOutputs = 0;
this.loadingOutputs = 0;
if (!silent) this.manager.output.set(this.manager.tabs.getActiveOutputTab());
if (!silent) this.manager.output.set(this.manager.tabs.getActiveTab("output"));
}
/**