Removed autoBakePause flag and statechange trigger in InputWaiter.set() as they are redundant.
This commit is contained in:
parent
0a709acafe
commit
a79be1e3ef
@ -39,7 +39,6 @@ class App {
|
||||
|
||||
this.baking = false;
|
||||
this.autoBake_ = false;
|
||||
this.autoBakePause = false;
|
||||
this.progress = 0;
|
||||
this.ingId = 0;
|
||||
|
||||
@ -155,11 +154,6 @@ class App {
|
||||
* Runs Auto Bake if it is set.
|
||||
*/
|
||||
autoBake() {
|
||||
// If autoBakePause is set, we are loading a full recipe (and potentially input), so there is no
|
||||
// need to set the staleness indicator. Just exit and wait until auto bake is called after loading
|
||||
// has completed.
|
||||
if (this.autoBakePause) return false;
|
||||
|
||||
if (this.baking) {
|
||||
this.manager.worker.cancelBakeForAutoBake();
|
||||
this.baking = false;
|
||||
@ -241,7 +235,7 @@ class App {
|
||||
action: "setInput",
|
||||
data: {
|
||||
inputNum: inputNum,
|
||||
silent: false
|
||||
silent: true
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -478,7 +472,6 @@ class App {
|
||||
* @fires Manager#statechange
|
||||
*/
|
||||
loadURIParams(params=this.getURIParams()) {
|
||||
this.autoBakePause = true;
|
||||
this.uriParams = params;
|
||||
|
||||
// Read in recipe from URI params
|
||||
@ -545,12 +538,7 @@ class App {
|
||||
this.manager.options.changeTheme(Utils.escapeHtml(this.uriParams.theme));
|
||||
}
|
||||
|
||||
this.autoBakePause = false;
|
||||
|
||||
// Dispatch stateChange only if not done by setInput
|
||||
if (this.uriParams.input) {
|
||||
window.dispatchEvent(this.manager.statechange);
|
||||
}
|
||||
window.dispatchEvent(this.manager.statechange);
|
||||
}
|
||||
|
||||
|
||||
@ -583,10 +571,6 @@ class App {
|
||||
setRecipeConfig(recipeConfig) {
|
||||
document.getElementById("rec-list").innerHTML = null;
|
||||
|
||||
// Pause auto-bake while loading but don't modify `this.autoBake_`
|
||||
// otherwise `manualBake` cannot trigger.
|
||||
this.autoBakePause = true;
|
||||
|
||||
for (let i = 0; i < recipeConfig.length; i++) {
|
||||
const item = this.manager.recipe.addOperation(recipeConfig[i].op);
|
||||
|
||||
@ -621,9 +605,6 @@ class App {
|
||||
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
// Unpause auto bake
|
||||
this.autoBakePause = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -215,7 +215,8 @@ class InputWaiter {
|
||||
* Handler for Chr Enc change events
|
||||
* Sets the input character encoding
|
||||
* @param {number} chrEncVal
|
||||
* @param {boolean} [manual=false]
|
||||
* @param {boolean} [manual=false] - Flag to indicate the encoding was set by the user
|
||||
* @param {boolean} [internal=false] - Flag to indicate this was set internally, i.e. by loading from URI
|
||||
*/
|
||||
chrEncChange(chrEncVal, manual=false, internal=false) {
|
||||
if (typeof chrEncVal !== "number") return;
|
||||
@ -641,10 +642,6 @@ class InputWaiter {
|
||||
const inputStr = toBase64(inputVal, "A-Za-z0-9+/");
|
||||
this.app.updateURL(true, inputStr);
|
||||
}
|
||||
|
||||
// Trigger a state change
|
||||
if (!silent) window.dispatchEvent(this.manager.statechange);
|
||||
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user