diff --git a/src/js/config/OperationConfig.js b/src/js/config/OperationConfig.js
index 686a6001..cf5149db 100755
--- a/src/js/config/OperationConfig.js
+++ b/src/js/config/OperationConfig.js
@@ -3135,7 +3135,7 @@ var OperationConfig = {
]
},
"Wait": {
- description: "Waits for a number of milliseconds.",
+ description: "Sleeps for a number of milliseconds.",
run: FlowControl.runWait,
inputType: "string",
outputType: "string",
diff --git a/src/js/core/Chef.js b/src/js/core/Chef.js
index c10796db..1c767f01 100755
--- a/src/js/core/Chef.js
+++ b/src/js/core/Chef.js
@@ -79,7 +79,6 @@ Chef.prototype.bake = function(inputText, recipeConfig, options, progress, step)
chef.dish.get(Dish.HTML) :
chef.dish.get(Dish.STRING);
ret.type = Dish.enumLookup(chef.dish.type);
-
ret.duration = new Date().getTime() - startTime;
ret.progress = progress;
@@ -90,7 +89,6 @@ Chef.prototype.bake = function(inputText, recipeConfig, options, progress, step)
chef.dish.get(Dish.HTML) :
chef.dish.get(Dish.STRING);
ret.type = Dish.enumLookup(chef.dish.type);
-
ret.duration = new Date().getTime() - startTime;
ret.progress = err.progress;
ret.error = err;
diff --git a/src/js/core/FlowControl.js b/src/js/core/FlowControl.js
index bad9d1e6..7ad46c8c 100755
--- a/src/js/core/FlowControl.js
+++ b/src/js/core/FlowControl.js
@@ -225,8 +225,8 @@ var FlowControl = {
* @returns {Object} The updated state of the recipe.
*/
runWait: function(state) {
- var ings = state.opList[state.progress].getIngValues(),
- sleepTime = ings[0];
+ var ings = state.opList[state.progress].getIngValues(),
+ sleepTime = ings[0];
return new Promise(function(resolve, reject) {
setTimeout(function() {
diff --git a/src/js/views/html/HTMLApp.js b/src/js/views/html/HTMLApp.js
index 604fe449..a6c8ce95 100755
--- a/src/js/views/html/HTMLApp.js
+++ b/src/js/views/html/HTMLApp.js
@@ -24,13 +24,11 @@ var HTMLApp = function(categories, operations, defaultFavourites, defaultOptions
this.chef = new Chef();
this.manager = new Manager(this);
+ this.baking = false;
this.autoBake_ = false;
this.progress = 0;
this.ingId = 0;
- this.baking = false;
- this.rebake = false;
-
window.chef = this.chef;
};
@@ -70,11 +68,12 @@ HTMLApp.prototype.handleError = function(err) {
* @param {bakingStatus}
*/
HTMLApp.prototype.setBakingStatus = function(bakingStatus) {
- var inputLoadingIcon = document.querySelector("#input .title .loading-icon");
- var outputLoadingIcon = document.querySelector("#output .title .loading-icon");
+ this.baking = bakingStatus;
- var inputElement = document.querySelector("#input-text");
- var outputElement = document.querySelector("#output-text");
+ var inputLoadingIcon = document.querySelector("#input .title .loading-icon"),
+ outputLoadingIcon = document.querySelector("#output .title .loading-icon"),
+ inputElement = document.querySelector("#input-text"),
+ outputElement = document.querySelector("#output-text");
if (bakingStatus) {
inputLoadingIcon.style.display = "inline-block";
@@ -97,49 +96,30 @@ HTMLApp.prototype.setBakingStatus = function(bakingStatus) {
/**
* Calls the Chef to bake the current input using the current recipe.
*
- * @param {boolean} [step] - Set to true if we should only execute one operation instead of the
- * whole recipe.
+ * @param {boolean} [step] - Set to true if we should only execute one operation instead of the whole recipe.
*/
HTMLApp.prototype.bake = function(step) {
var app = this;
- if (app.baking) {
- if (!app.rebake) {
- // We do not want to keep autobaking
- // Say that we will rebake and then try again later
- app.rebake = true;
- setTimeout(function() {
- app.bake(step);
- }, 500);
- }
+ if (app.baking) return;
- return;
- }
-
- app.rebake = false;
- app.baking = true;
app.setBakingStatus(true);
try {
app.chef.bake(
- app.getInput(), // The user's input
+ app.getInput(), // The user's input
app.getRecipeConfig(), // The configuration of the recipe
- app.options, // Options set by the user
- app.progress, // The current position in the recipe
- step // Whether or not to take one step or execute the whole recipe
+ app.options, // Options set by the user
+ app.progress, // The current position in the recipe
+ step // Whether or not to take one step or execute the whole recipe
)
.then(function(response) {
- app.baking = false;
app.setBakingStatus(false);
- if (!response) {
- return;
- }
- if (response.error) {
- app.handleError(response.error);
- }
+ if (!response) return;
+ if (response.error) app.handleError(response.error);
- app.options = response.options;
+ app.options = response.options;
if (response.type === "html") {
app.dishStr = Utils.stripHtmlTags(response.result, true);
@@ -159,10 +139,9 @@ HTMLApp.prototype.bake = function(step) {
}
})
.catch(function(err) {
- console.error("Chef's promise was rejected, should never occur");
+ console.error("Chef's promise was rejected, this should never occur");
});
} catch (err) {
- app.baking = false;
app.setBakingStatus(false);
app.handleError(err);
}