Skip to content

Commit 0b663d6

Browse files
authored
resolved
1 parent 79ae48f commit 0b663d6

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

1-js/11-async/02-promise-basics/article.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,28 @@ let promise = new Promise(function(resolve, reject) {
6060
۱. اجرا‌کننده به صورت خودکار و بلافاصله فراخوانی می‌شود (توسط `new Promise`).<br />
6161
۲. اجرا‌کننده دو آرگومان دریافت می‌کند: `resolve` و `reject`. این توابع توسط موتور جاوااسکریپت از پیش تعریف شده‌اند, بنابراین ما نیازی به ایجاد آن‌ها نداریم. وقتی آماده شدیم فقط باید یکی از آن‌ها را فراخوانی کنیم.
6262

63-
After one second of "processing" the executor calls `resolve("done")` to produce the result. This changes the state of the `promise` object:
63+
:را تغییر می‌دهد `promise` را برای ایجاد نتیجه فراخوانی می‌کند. این وضعیت شیء `resolve("done")` پس از یک ثانیه "پردازش"، اجرا‌کننده
6464

6565
![](promise-resolve-1.svg)
6666

67-
That was an example of a successful job completion, a "fulfilled promise".
67+
این نمونه‌ای از تکمیل موفقیت آمیز کار بود، یک "fulfilled promise".
6868

69-
And now an example of the executor rejecting the promise with an error:
69+
و حال نمونه‌ای از ردشدن(rejecting) وعده‌ی(promise) اجرا‌کننده با یک خطا:
7070

7171
```js
7272
let promise = new Promise(function(resolve, reject) {
73-
// after 1 second signal that the job is finished with an error
73+
// بعد از 1 ثانیه سیگنال می‌دهد که کار با یک خطا تمام شده است
7474
setTimeout(() => *!*reject(new Error("Whoops!"))*/!*, 1000);
7575
});
7676
```
7777

78-
The call to `reject(...)` moves the promise object to `"rejected"` state:
78+
فراخوانیِ `(...)reject` شیء وعده(promise) را به وضعیت `"rejected"` می‌برد:
7979

8080
![](promise-reject-1.svg)
8181

82-
To summarize, the executor should perform a job (usually something that takes time) and then call `resolve` or `reject` to change the state of the corresponding promise object.
82+
به طور خلاصه، اجرا‌کننده باید یک کار را انجام دهد (معمولاً کاری که زمان می‌برد) و سپس `resolve` یا `reject` را برای تغییر وضعیت شیء وعده‌ی(promise) مربوطه فراخوانی کند.
8383

84-
A promise that is either resolved or rejected is called "settled", as opposed to an initially "pending" promise.
84+
به وعده‌ای که یا حل‌و‌فصل(resolved) می‌شود یا رد(rejected) می‌شود، "تسویه‌شده" ("settled") می‌گویند، برخلاف وعده‌ای(promise) که در ابتدا "درحال انتظار" ("pending") است.
8585

8686
````smart header="There can be only a single result or an error"
8787
The executor should call only one `resolve` or one `reject`. Any state change is final.

0 commit comments

Comments
 (0)