You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -232,11 +232,11 @@ The `results` in the line `(*)` above will be:
232
232
]
233
233
```
234
234
235
-
So, for each promise we get its status and `value/reason`.
235
+
Dolayısıyla, her söz için onun satütüsünü ve `değer/sebep` bilgisini alırız.
236
236
237
237
### Polyfill
238
238
239
-
If the browser doesn't support `Promise.allSettled`, it's easy to polyfill:
239
+
Eğer tarayıcı `Promise.allSettled` özelliğini desteklemiyorsa, polyfill kolaydır.
240
240
241
241
```js
242
242
if(!Promise.allSettled) {
@@ -252,23 +252,23 @@ if(!Promise.allSettled) {
252
252
}
253
253
```
254
254
255
-
In this code, `promises.map` takes input values, turns into promises (just in case a non-promise was passed) with `p => Promise.resolve(p)`, and then adds `.then` handler to it.
255
+
Bu kodda, `promises.map` giriş değerini alır, `p => Promise.resolve(p)` ile sözleri döndürüyor (sadece bir söz verilmemişse) ve sonra bunu işleyiciye ekler.
256
256
257
-
That handler turns a successful result `v` into `{state:'fulfilled', value:v}`, and an error `r` into `{state:'rejected', reason:r}`. That's exactly the format of `Promise.allSettled`.
257
+
Bu işleyici başarılı bir `v` sonucusunu `{state:'fulfilled', value:v}` ve bir `r` hatasını `{state:'rejected', reason:r}` olarak çevirir. Bu `Promise.allSettled` formatıyla aynıdır.
258
258
259
-
Then we can use `Promise.allSettled` to get the results or *all* given promises, even if some of them reject.
259
+
Sonra bazı sonuçları reddetse bile sonuçları almak ya da *all* sözleri vermek için `Promise.allSettled`i kullanabiliriz.
260
260
261
261
## Promise.race
262
262
263
-
Similar to `Promise.all`, it takes an iterable of promises, but instead of waiting for all of them to finish, it waits for the first result (or error), and goes on with it.
263
+
`Promise.all` benzer şekilde sözler yenilenebilir. Ancak hepsinin bitmesini beklemek yerine ilk sonucu (veya hatayı) bekler ve devam eder.
264
264
265
-
The syntax is:
265
+
Söz dizimi:
266
266
267
267
```js
268
268
let promise = Promise.race(iterable);
269
269
```
270
270
271
-
For instance, here the result will be `1`:
271
+
Mesela burada sonuç `1` olacak:
272
272
273
273
```js run
274
274
Promise.race([
@@ -278,18 +278,17 @@ Promise.race([
278
278
]).then(alert); // 1
279
279
```
280
280
281
-
So, the first result/error becomes the result of the whole `Promise.race`. After the first settled promise "wins the race", all further results/errors are ignored.
282
-
283
-
## Summary
281
+
Böylece ilk sonuç/hata bütün `Promise.race` sonucu olur. İlk kararlaştırılan sözün ardından "yarışı kazanır", diğer tüm sonuçlar/hatalar göz ardı edilir
284
282
285
-
There are 5 static methods of `Promise` class:
283
+
## Özetle
286
284
287
-
1. `Promise.resolve(value)` -- makes a resolved promise with the given value.
288
-
2. `Promise.reject(error)` -- makes a rejected promise with the given error.
289
-
3. `Promise.all(promises)` -- waits for all promises to resolve and returns an array of their results. If any of the given promises rejects, then it becomes the error of `Promise.all`, and all other results are ignored.
290
-
4. `Promise.allSettled(promises)` (a new method) -- waits for all promises to resolve or reject and returns an array of their results as object with:
291
-
- `state`: `'fulfilled'` or `'rejected'`
292
-
- `value` (if fulfilled) or `reason` (if rejected).
293
-
5. `Promise.race(promises)` -- waits for the first promise to settle, and its result/error becomes the outcome.
285
+
`Promise` sınıfının 5 statik metodu vardır:
294
286
295
-
Of these five, `Promise.all/allSettled` are the most common in practice.
287
+
1. `Promise.resolve(value)` -- verilen değerle çözümlenmiş bir söz verir.
288
+
2. `Promise.reject(error)` -- verilen hata ile reddedilen bir söz verir..
289
+
3. `Promise.all(promises)` -- çözmek için tüm sözleri bekler ve sonuçlarının bir dizisini döndürür. Eğer verilen sözlerden herhangi biri reddederse o zaman `Promise.all` hatası olur ve diğer tüm sonuçlar göz ardı edilir.
290
+
4. `Promise.allSettled(promises)` (yeni bir metod) -- tüm sözlerin çözülmesini veya reddedilmesini bekler ve sonuçlarının bir dizisini nesne olarak döndürür.
291
+
- `state`: `'fulfilled'` yada `'rejected'`
292
+
- `value` (if fulfilled) ya da `reason` (reddedilirse).
293
+
5. `Promise.race(promises)` -- ilk yerlmeşmeye söz vermek için bekler ve sonucu/hatası sonuç olur.
294
+
Bu beş maddede `Promise.all/allSettled` en yaygın kullanılanıdır.
0 commit comments