Skip to content

Commit 115385e

Browse files
authored
Merge pull request #197 from Beroozam/master
Promise
2 parents 90e6e9a + 9763d18 commit 115385e

File tree

7 files changed

+142
-142
lines changed

7 files changed

+142
-142
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
The output is: `1`.
1+
خروجی: `1`.
22

3-
The second call to `resolve` is ignored, because only the first call of `reject/resolve` is taken into account. Further calls are ignored.
3+
فراخوانی دوم برای `resolve` نادیده گرفته می‌شود، زیرا فقط اولین فراخوانی `reject/resolve` در نظر گرفته می‌شود. فراخوانی‌های بعدی نادیده گرفته می‌شوند.

1-js/11-async/02-promise-basics/01-re-resolve/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
# Re-resolve a promise?
2+
# آیا یک Promise دوباره resolve می‌شود؟
33

44

5-
What's the output of the code below?
5+
خروجی کد زیر چیست؟
66

77
```js
88
let promise = new Promise(function(resolve, reject) {

1-js/11-async/02-promise-basics/02-delay-promise/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function delay(ms) {
33
return new Promise(resolve => setTimeout(resolve, ms));
44
}
55

6-
delay(3000).then(() => alert('runs after 3 seconds'));
6+
delay(3000).then(() => alert('بعد از 3 ثانیه اجرا می‌شود'));
77
```
88

9-
Please note that in this task `resolve` is called without arguments. We don't return any value from `delay`, just ensure the delay.
9+
لطفاً توجه داشته باشید که در این تمرین `resolve` بدون آرگومان فراخوانی می‌شود. ما هیچ مقداری را از `delay` بر نمی‌گردانیم، فقط از تاخیر اطمینان حاصل می‌کنیم.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

2-
# Delay with a promise
2+
# تاخیر با Promise
33

4-
The built-in function `setTimeout` uses callbacks. Create a promise-based alternative.
4+
تابع داخلی `setTimeout` از کال‌بک‌ها استفاده می‌کند. یک جایگزین مبتنی بر Promise ایجاد کنید.
55

6-
The function `delay(ms)` should return a promise. That promise should resolve after `ms` milliseconds, so that we can add `.then` to it, like this:
6+
تابع `delay(ms)` باید یک Promise برگرداند. این وعده باید پس از `ms` میلی‌ثانیه حل‌وفصل (resolve) شود، به طوری که می‌توانیم `then.` را به آن اضافه کنیم، مانند این:
77

88
```js
99
function delay(ms) {
10-
// your code
10+
// کد شما
1111
}
1212

13-
delay(3000).then(() => alert('runs after 3 seconds'));
13+
delay(3000).then(() => alert('بعد از 3 ثانیه اجرا می‌شود'));
1414
```

1-js/11-async/02-promise-basics/03-animate-circle-promise/solution.view/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222

2323
<body>
2424

25-
<button onclick="go()">Click me</button>
25+
<button onclick="go()">روی من کلیک کن</button>
2626

2727
<script>
2828

2929
function go() {
3030
showCircle(150, 150, 100).then(div => {
3131
div.classList.add('message-ball');
32-
div.append("Hello, world!");
32+
div.append("سلام دنیا!");
3333
});
3434
}
3535

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

2-
# Animated circle with promise
2+
# دایره متحرک با Promise
33

4-
Rewrite the `showCircle` function in the solution of the task <info:task/animate-circle-callback> so that it returns a promise instead of accepting a callback.
4+
تابع `showCircle` را در راه‌حل تمرین <info:task/animate-circle-callback> بازنویسی کنید تا به جای پذیرش کال‌بک، یک Promise را برگرداند.
55

6-
The new usage:
6+
کاربرد جدید:
77

88
```js
99
showCircle(150, 150, 100).then(div => {
1010
div.classList.add('message-ball');
11-
div.append("Hello, world!");
11+
div.append("سلام دنیا!");
1212
});
1313
```
1414

15-
Take the solution of the task <info:task/animate-circle-callback> as the base.
15+
راه‌حل تمرین <info:task/animate-circle-callback> را به عنوان پایه در نظر بگیرید.

0 commit comments

Comments
 (0)