Skip to content

Commit b7a7f68

Browse files
authored
fix conflict --22-6
1 parent 12b90b6 commit b7a7f68

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

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

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,7 @@ if(!Promise.allSettled) {
193193
194194
في هذا الرمز ، يأخذ `promises.map` قيم الإدخال ، ويحولها إلى وعود (فقط في حالة تمرير عدم الوعد) مع` p => Promise.resolve (p) `، ثم يضيف معالج` .then` إلى كل واحد.
195195
196-
<<<<<<< HEAD
197-
يحول هذا المعالج نتيجة "القيمة" الناجحة إلى "{state:" الوفاء "و value}` والخطأ "reason" إلى "{state: "رفض"، reason} `. هذا هو بالضبط تنسيق `Promise.allSettled`.
198-
=======
199-
That handler turns a successful result `value` into `{status:'fulfilled', value}`, and an error `reason` into `{status:'rejected', reason}`. That's exactly the format of `Promise.allSettled`.
200-
>>>>>>> e4e6a50b5762dd5dc4c0f0c58f870c64be39dcfa
196+
يحول هذا المعالج نتيجة `القيمة` الناجحة إلى `{status:'fulfilled', value}` والخطأ `reason` إلى `{status:'rejected', reason}`. هذا هو بالضبط تنسيق `Promise.allSettled`.
201197
202198
الآن يمكننا استخدام "Promise.allSettled" للحصول على نتائج * جميع * الوعود المعطاة ، حتى لو رفض بعضها.
203199
@@ -281,22 +277,12 @@ let promise = new Promise((resolve, reject) => reject(error));
281277
282278
هناك 5 طرق ثابتة لفئة `Promise`:
283279
284-
<<<<<<< HEAD
285280
1. "Promise.all (الوعود)" - تنتظر جميع الوعود لحل وإرجاع مجموعة من نتائجها. إذا تم رفض أي من الوعود المعطاة ، يصبح خطأ "Promise.all" ، ويتم تجاهل جميع النتائج الأخرى.
286281
2. "Promise.allSettled (الوعود)" (الطريقة المضافة حديثًا) - تنتظر جميع الوعود بتسوية نتائجها وإعادتها كمجموعة من الأشياء مع:
287282
- `الدولة`:` `محقق '' أو` `مرفوض ''
288283
- "القيمة" (إذا تحققت) أو "السبب" (إذا تم رفضها).
289284
3. "الوعد" (الوعود) - ينتظر الوعد الأول بالاستقرار ، وتصبح نتيجته / خطأه النتيجة.
290285
4. "Promise.resolve (القيمة)" - يقدم وعدًا ثابتًا بقيمة معينة.
291286
5. "Promise.reject (خطأ)" - يقدم وعدًا مرفوضًا مع الخطأ المحدد.
292-
=======
293-
1. `Promise.all(promises)` -- waits for all promises to resolve and returns an array of their results. If any of the given promises rejects, it becomes the error of `Promise.all`, and all other results are ignored.
294-
2. `Promise.allSettled(promises)` (recently added method) -- waits for all promises to settle and returns their results as an array of objects with:
295-
- `status`: `"fulfilled"` or `"rejected"`
296-
- `value` (if fulfilled) or `reason` (if rejected).
297-
3. `Promise.race(promises)` -- waits for the first promise to settle, and its result/error becomes the outcome.
298-
4. `Promise.resolve(value)` -- makes a resolved promise with the given value.
299-
5. `Promise.reject(error)` -- makes a rejected promise with the given error.
300-
>>>>>>> e4e6a50b5762dd5dc4c0f0c58f870c64be39dcfa
301-
302-
من بين هذه العناصر الخمسة ، يعد "Promise.all" الأكثر شيوعًا في الممارسة.
287+
288+
من بين هذه العناصر الخمسة ، يعد "Promise.all" الأكثر شيوعًا في الممارسة.

0 commit comments

Comments
 (0)