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
Copy file name to clipboardExpand all lines: 1-js/11-async/02-promise-basics/article.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,30 +123,30 @@ let promise = new Promise(function(resolve, reject) {
123
123
خوبه. ما بلافاصله یک وعده(promise) حلشده(resolved) داریم.
124
124
````
125
125
126
-
```smart header="The `state` and `result` are internal"
127
-
The properties `state` and `result` of the Promise object are internal. We can't directly access them. We can use the methods `.then`/`.catch`/`.finally` for that. They are described below.
128
-
```
126
+
```smart header="داخلی هستند `result` و `state`"
127
+
.استفاده کنیم. در زیر توضیح داده شدهاند `.then`/`.catch`/`.finally` داخلی هستند. ما نمیتوانیم مستقیماً به آنها دسترسی داشته باشیم. برای این کار میتوانیم از متدهای Promise شیء `result` و `state` ویژگی های
128
+
`````
129
129
130
-
## Consumers: then, catch, finally
130
+
## مصرفکنندگان: then, catch, finally
131
131
132
-
A Promise object serves as a link between the executor (the "producing code" or "singer") and the consuming functions (the "fans"), which will receive the result or error. Consuming functions can be registered (subscribed) using methods `.then`, `.catch` and `.finally`.
132
+
یک شیء Promise به عنوان یک پیوند بین اجراکننده ("کد تولیدکننده" یا "خواننده") و توابع مصرفکننده ("طرفداران") عمل میکند که نتیجه یا خطا را دریافت میکند. توابع مصرفکننده را میتوان با استفاده از متدهای `then`، `.catch.` و `finally.` ثبت (مشترک) کرد.
133
133
134
-
### then
134
+
### متدِ then
135
135
136
-
The most important, fundamental one is `.then`.
136
+
مهم ترین و اساسی ترین آن `then.` است.
137
137
138
-
The syntax is:
138
+
نحو(syntax) عبارت است از:
139
139
140
140
```js
141
141
promise.then(
142
-
function(result) { *!*/* handle a successful result */*/!* },
143
-
function(error) { *!*/* handle an error */*/!* }
142
+
function(result) { *!*/* یک نتیجه موفق را مدیریت کنید */*/!* },
143
+
function(error) { *!*/* یک خطا را مدیریت کنید */*/!* }
144
144
);
145
145
```
146
146
147
-
The first argument of `.then` is a function that runs when the promise is resolved, and receives the result.
147
+
اولین آرگومان `then.` تابعی است که با حل شدن(resolved) وعده(promise) اجرا میشود و نتیجه را دریافت میکند.
148
148
149
-
The second argument of `.then` is a function that runs when the promise is rejected, and receives the error.
149
+
آرگومان دوم `then.` تابعی است که با رد شدن(rejected) وعده(promise) اجرا میشود و خطا را دریافت میکند.
150
150
151
151
For instance, here's a reaction to a successfully resolved promise:
0 commit comments