Fix stepping again.

Add new getInput function to inputWorker
This commit is contained in:
j433866 2019-05-28 11:59:57 +01:00
parent 0bced35931
commit 7528065d4d
6 changed files with 111 additions and 24 deletions

View file

@ -102,6 +102,9 @@ self.addEventListener("message", function(e) {
case "step":
self.autoBake(r.data, true);
break;
case "getInput":
self.getInput(r.data);
break;
default:
log.error(`Unknown action '${r.action}'.`);
}
@ -228,6 +231,34 @@ self.getInputValue = function(inputNum) {
return "";
};
/**
* Gets the stored value or oobject for a specific inputNum and sends it to the inputWaiter.
*
* @param {object} inputData - Object containing data about the input to retrieve
* @param {number} inputData.inputNum - The inputNum of the input to get
* @param {boolean} inputData.getObj - If true, returns the entire input object instead of just the value
* @param {number} inputData.id - The callback ID for the callback to run when returned to the inputWaiter
*/
self.getInput = function(inputData) {
if (inputData.getObj) {
self.postMessage({
action: "getInput",
data: {
data: self.getInputObj(inputData.inputNum),
id: inputData.id
}
});
} else {
self.postMessage({
action: "getInput",
data: {
data: self.getInputValue(inputData.inputNum),
id: inputData.id
}
});
}
};
/**
* Gets the load progress for a specific inputNum
*