Add getDishTitle function

This commit is contained in:
j433866 2019-06-13 09:43:58 +01:00
parent f497dc3170
commit 6ee76e3bf0
5 changed files with 102 additions and 3 deletions

View file

@ -631,6 +631,31 @@ class WorkerWaiter {
});
}
/**
* Asks the ChefWorker to get the title of the dish
*
* @param {Dish} dish
* @param {number} maxLength
* @param {Function} callback
* @returns {string}
*/
getDishTitle(dish, maxLength, callback) {
const id = this.callbackID++;
this.callbacks[id] = callback;
if (this.dishWorker === null) this.setupDishWorker();
this.dishWorker.postMessage({
action: "getDishTitle",
data: {
dish: dish,
maxLength: maxLength,
id: id
}
});
}
/**
* Sets the console log level in the workers.
*/