Skip to content

Commit b4ecbc7

Browse files
authored
197. satırda kaldım.
1 parent a30c056 commit b4ecbc7

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

1-js/11-async/05-promise-api/article.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,12 @@ Promise.all([
8888
]).then(alert); // 1,2,3 sözler hazır olduğunda: her söz bir dizi üyesine katkıda bulunur
8989
```
9090

91-
Please note that the relative order is the same. Even though the first promise takes the longest time to resolve, it is still first in the array of results.
91+
Lütfen göreli siparişin aynı olduğunu unutmayın. İlk sözün sözülmesi uzun sürse bile sonuçta ilk sırada yer almaktadır.
9292

93-
A common trick is to map an array of job data into an array of promises, and then wrap that into `Promise.all`.
93+
Yayın bir hile, bir dizi iş verisini bir dizi sözle eşleştirmek ve ardından bunu `Promise.all` içine kaydırmaktır.
94+
95+
Örneğin, eğer bir dizi URL'miz varsa hepsini şöyle getirebiliriz:
9496

95-
For instance, if we have an array of URLs, we can fetch them all like this:
9697

9798
```js run
9899
let urls = [
@@ -101,17 +102,18 @@ let urls = [
101102
'https://api.github.com/users/jeresig'
102103
];
103104

104-
// map every url to the promise of the fetch
105+
// Her URL'yi getirme sözüyle eşleyin
105106
let requests = urls.map(url => fetch(url));
106107

107-
// Promise.all waits until all jobs are resolved
108+
// Tüm işler çözülene kadar Promise.all bekler
108109
Promise.all(requests)
109110
.then(responses => responses.forEach(
110111
response => alert(`${response.url}: ${response.status}`)
111112
));
112113
```
113114

114-
A bigger example with fetching user information for an array of github users by their names (or we could fetch an array of goods by their ids, the logic is same):
115+
Bir dizi github kullanıcısı için kullanıcı bilgilerini adlarına göre almakla ilgili daha büyük bir örnek (veya bir mal dizisini kimlikleriyle alabiliriz. Mantık aynıdır):
116+
115117

116118
```js run
117119
let names = ['iliakan', 'remy', 'jeresig'];
@@ -120,22 +122,22 @@ let requests = names.map(name => fetch(`https://api.github.com/users/${name}`));
120122

121123
Promise.all(requests)
122124
.then(responses => {
123-
// all responses are ready, we can show HTTP status codes
125+
// Tüm cevaplar hazır. HTTP durum kodlarını gösterebiliriz
124126
for(let response of responses) {
125-
alert(`${response.url}: ${response.status}`); // shows 200 for every url
127+
alert(`${response.url}: ${response.status}`); // Her URL için 200 gösterir
126128
}
127129

128130
return responses;
129131
})
130-
// map array of responses into array of response.json() to read their content
132+
// Yanıt dizisini, içeriğini okumak için response.json() dizisine eşleyin
131133
.then(responses => Promise.all(responses.map(r => r.json())))
132-
// all JSON answers are parsed: "users" is the array of them
134+
// Tüm JSON cevapları ayrıştırılır: "users" bunların dizisidir.
133135
.then(users => users.forEach(user => alert(user.name)));
134136
```
135137

136-
**If any of the promises is rejected, `Promise.all` immediately rejects with that error.**
138+
**Eğer sözlerden herhangi biri ret edildiyse `Promise.all` bu hatayı hemen ret eder**
137139

138-
For instance:
140+
Örneğin:
139141

140142
```js run
141143
Promise.all([
@@ -147,47 +149,49 @@ Promise.all([
147149
]).catch(alert); // Error: Whoops!
148150
```
149151

150-
Here the second promise rejects in two seconds. That leads to immediate rejection of `Promise.all`, so `.catch` executes: the rejection error becomes the outcome of the whole `Promise.all`.
152+
İşte ikinci söz iki saniye içinde reddediyor. Bu `Promise.all`un hemen reddedilmesine yol açar, bu yüzden `.catch` çalıştırır: reddedilme hatası tüm `Promise.all`un sonucudur.
153+
151154

152155
```warn header="In case of an error, other promises are ignored"
153-
If one promise rejects, `Promise.all` immediately rejects, completely forgetting about the other ones in the list. Their results are ignored.
156+
Eğer bir söz reddederse, `Promise.all` derhal reddeder. Listedeki diğerlerini tamamen unutur. Onların sonuçları göz ardı edilir.
154157
155-
For example, if there are multiple `fetch` calls, like in the example above, and one fails, other ones will still continue to execute, but `Promise.all` don't watch them any more. They will probably settle, but the result will be ignored.
158+
Örneğin, yukarıdaki örnekte olduğu gibi birden fazla `fetch` çağrısı varsa ve biri başarısız olursa diğeri hala yürütülmeye devam eder. Ancak `Promise.all` artık onları izlememektedir. Muhtemelen yerleşecekler ancak sonuç göz ardı edilecektir.
156159
157-
`Promise.all` does nothing to cancel them, as there's no concept of "cancellation" in promises. In [another chapter](fetch-abort) we'll cover `AbortController` that aims to help with that, but it's not a part of the Promise API.
160+
`Promise.all` sözlerinde "iptal" kavramı olmadığı için onları iptal edecek hiçbir şey yapmaz. [Başka bir bölümde](fetch-abort) bu konuda yardımcı olmayı amaçlayan `AbortController`ı ele alacağız. Ancak bu Promise API'sinin bir parçası değil.
158161
```
159162

160163
````smart header="`Promise.all(...)` allows non-promise items in `iterable`"
161-
Normally, `Promise.all(...)` accepts an iterable (in most cases an array) of promises. But if any of those objects is not a promise, it's wrapped in `Promise.resolve`.
164+
Normalde, `Promise.all(...)` sözlerin yenilenebilir (çoğu durumda bir dizi) kabul eder. Ancak bu nesnelerden herhangi biri bir söz değilse `Promise.respove` içine sarılır.
165+
```
162166
163-
For instance, here the results are `[1, 2, 3]`:
167+
Örneğin burada `[1, 2, 3]` döner:
164168
165169
```js run
166170
Promise.all([
167171
new Promise((resolve, reject) => {
168172
setTimeout(() => resolve(1), 1000)
169173
}),
170-
2, // treated as Promise.resolve(2)
171-
3 // treated as Promise.resolve(3)
174+
2, // Promise.resolve(2) olarak kabul edildi.
175+
3 // Promise.resolve(3) olarak kabul edildi.
172176
]).then(alert); // 1, 2, 3
173177
```
174178

175-
So we are able to pass non-promise values to `Promise.all` where convenient.
179+
Bu yüzden uygun olmayan durumlarda `Promise.all`a söz etmeyen değerleri aktarabiliriz.
176180

177181
````
178182
179183
## Promise.allSettled
180184
181185
[recent browser="new"]
182186
183-
`Promise.all` rejects as a whole if any promise rejects. That's good in cases, when we need *all* results to go on:
187+
Herhangi bir söz reddederse `Promise.all` bir bütün olarak eder. Devam etmek için *all* sonuçlarına ihtiyacımız olduğunda bu iyidir:
184188
185189
```js
186190
Promise.all([
187191
fetch('/template.html'),
188192
fetch('/style.css'),
189193
fetch('/data.json')
190-
]).then(render); // render method needs them all
194+
]).then(render); // render yöntemi hepsine ihtiyaç duyuyor
191195
```
192196
193197
`Promise.allSettled` waits for all promises to settle: even if one rejects, it waits for the others. The resulting array has:

0 commit comments

Comments
 (0)