diff --git a/1-js/11-async/02-promise-basics/01-re-resolve/solution.md b/1-js/11-async/02-promise-basics/01-re-resolve/solution.md index 57046a257..6649bcf07 100644 --- a/1-js/11-async/02-promise-basics/01-re-resolve/solution.md +++ b/1-js/11-async/02-promise-basics/01-re-resolve/solution.md @@ -1,3 +1,3 @@ -The output is: `1`. +Výstup je: `1`. -The second call to `resolve` is ignored, because only the first call of `reject/resolve` is taken into account. Further calls are ignored. +Druhé volání `splň` se ignoruje, protože v úvahu se bere vždy jen první volání `splň/zamítni`. Další volání jsou ignorována. diff --git a/1-js/11-async/02-promise-basics/01-re-resolve/task.md b/1-js/11-async/02-promise-basics/01-re-resolve/task.md index 185806ed6..9ed1e1fb3 100644 --- a/1-js/11-async/02-promise-basics/01-re-resolve/task.md +++ b/1-js/11-async/02-promise-basics/01-re-resolve/task.md @@ -1,15 +1,15 @@ -# Re-resolve a promise? +# Znovusplnění příslibu? -What's the output of the code below? +Jaký je výstup následujícího kódu? ```js -let promise = new Promise(function(resolve, reject) { - resolve(1); +let příslib = new Promise(function(splň, zamítni) { + splň(1); - setTimeout(() => resolve(2), 1000); + setTimeout(() => splň(2), 1000); }); -promise.then(alert); +příslib.then(alert); ``` diff --git a/1-js/11-async/02-promise-basics/02-delay-promise/solution.md b/1-js/11-async/02-promise-basics/02-delay-promise/solution.md index 85e8baa44..ab8430fc5 100644 --- a/1-js/11-async/02-promise-basics/02-delay-promise/solution.md +++ b/1-js/11-async/02-promise-basics/02-delay-promise/solution.md @@ -1,9 +1,9 @@ ```js run -function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); +function čekej(ms) { + return new Promise(splň => setTimeout(splň, ms)); } -delay(3000).then(() => alert('runs after 3 seconds')); +čekej(3000).then(() => alert('spustí se za 3 sekundy')); ``` -Please note that in this task `resolve` is called without arguments. We don't return any value from `delay`, just ensure the delay. +Prosíme všimněte si, že v této úloze je `splň` voláno bez argumentů. Z funkce `čekej` nevracíme žádnou hodnotu, jen zajistíme čekání. diff --git a/1-js/11-async/02-promise-basics/02-delay-promise/task.md b/1-js/11-async/02-promise-basics/02-delay-promise/task.md index 0d74cf45d..e47577ce9 100644 --- a/1-js/11-async/02-promise-basics/02-delay-promise/task.md +++ b/1-js/11-async/02-promise-basics/02-delay-promise/task.md @@ -1,14 +1,14 @@ -# Delay with a promise +# Čekání s příslibem -The built-in function `setTimeout` uses callbacks. Create a promise-based alternative. +Vestavěná funkce `setTimeout` používá callbacky. Vytvořte alternativu založenou na příslibech. -The function `delay(ms)` should return a promise. That promise should resolve after `ms` milliseconds, so that we can add `.then` to it, like this: +Funkce `čekej(ms)` by měla vrátit příslib. Tento příslib by se měl splnit za `ms` milisekund, takže do něj můžeme přidat `.then`, například: ```js -function delay(ms) { - // your code +function čekej(ms) { + // váš kód } -delay(3000).then(() => alert('runs after 3 seconds')); +čekej(3000).then(() => alert('spustí se za 3 sekundy')); ``` diff --git a/1-js/11-async/02-promise-basics/03-animate-circle-promise/solution.view/index.html b/1-js/11-async/02-promise-basics/03-animate-circle-promise/solution.view/index.html index 6052f009e..aa49c5160 100644 --- a/1-js/11-async/02-promise-basics/03-animate-circle-promise/solution.view/index.html +++ b/1-js/11-async/02-promise-basics/03-animate-circle-promise/solution.view/index.html @@ -22,18 +22,18 @@ - + diff --git a/1-js/11-async/02-promise-basics/promise-reject-1.svg b/1-js/11-async/02-promise-basics/promise-reject-1.svg index 777e47739..2103a7991 100644 --- a/1-js/11-async/02-promise-basics/promise-reject-1.svg +++ b/1-js/11-async/02-promise-basics/promise-reject-1.svg @@ -1 +1 @@ -new Promise(executor)state: "pending" result: undefinedreject(error)state: "rejected" result: error \ No newline at end of file +new Promise(exekutor)state: "pending" result: undefinedreject(chyba)state: "rejected" result: chyba \ No newline at end of file diff --git a/1-js/11-async/02-promise-basics/promise-resolve-1.svg b/1-js/11-async/02-promise-basics/promise-resolve-1.svg index f1f34eaee..d42a29127 100644 --- a/1-js/11-async/02-promise-basics/promise-resolve-1.svg +++ b/1-js/11-async/02-promise-basics/promise-resolve-1.svg @@ -1 +1 @@ -new Promise(executor)state: "pending" result: undefinedresolve("done")state: "fulfilled" result: "done" \ No newline at end of file +new Promise(exekutor)state: "pending" result: undefinedresolve("hotovo")state: "fulfilled" result: "hotovo" \ No newline at end of file diff --git a/1-js/11-async/02-promise-basics/promise-resolve-reject.svg b/1-js/11-async/02-promise-basics/promise-resolve-reject.svg index 80593a3a4..cb23b05ef 100644 --- a/1-js/11-async/02-promise-basics/promise-resolve-reject.svg +++ b/1-js/11-async/02-promise-basics/promise-resolve-reject.svg @@ -1 +1 @@ -new Promise(executor)state: "pending" result: undefinedresolve(value)reject(error)state: "fulfilled" result: valuestate: "rejected" result: error \ No newline at end of file +new Promise(exekutor)state: "pending" result: undefinedresolve(hodnota)reject(chyba)state: "fulfilled" result: hodnotastate: "rejected" result: chyba \ No newline at end of file