Skip to content

Commit f3128b3

Browse files
committed
translated until line 158
1 parent da4a3e1 commit f3128b3

File tree

1 file changed

+18
-18
lines changed
  • 1-js/06-advanced-functions/08-settimeout-setinterval

1 file changed

+18
-18
lines changed

1-js/06-advanced-functions/08-settimeout-setinterval/article.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,40 +106,40 @@ Pentru browsere, temporizatoarele sunt descrise în [secțiunea timers](https://
106106

107107
## setInterval
108108

109-
The `setInterval` method has the same syntax as `setTimeout`:
109+
Metoda `setInterval` are aceeași sintaxă ca și `setTimeout`:
110110

111111
```js
112-
let timerId = setInterval(func|code, [delay], [arg1], [arg2], ...)
112+
let timerId = setInterval(func|cod, [întârziere], [arg1], [arg2], ...)
113113
```
114114

115-
All arguments have the same meaning. But unlike `setTimeout` it runs the function not only once, but regularly after the given interval of time.
115+
Toate argumentele au aceeași semnificație. Dar spre deosebire de `setTimeout` acesta rulează funcția nu doar o singură dată, ci în mod regulat după intervalul de timp dat.
116116

117-
To stop further calls, we should call `clearInterval(timerId)`.
117+
Pentru a opri apelurile ulterioare, ar trebui să apelăm `clearInterval(timerId)`.
118118

119-
The following example will show the message every 2 seconds. After 5 seconds, the output is stopped:
119+
Următorul exemplu va afișa mesajul la fiecare 2 secunde. După 5 secunde, ieșirea este oprită:
120120

121121
```js run
122-
// repeat with the interval of 2 seconds
123-
let timerId = setInterval(() => alert('tick'), 2000);
122+
// se repetă cu intervalul de 2 secunde
123+
let timerId = setInterval(() => alert('tic'), 2000);
124124

125-
// after 5 seconds stop
125+
// după 5 secunde se oprește
126126
setTimeout(() => { clearInterval(timerId); alert('stop'); }, 5000);
127127
```
128128

129-
```smart header="Time goes on while `alert` is shown"
130-
In most browsers, including Chrome and Firefox the internal timer continues "ticking" while showing `alert/confirm/prompt`.
129+
```smart header="Timpul continuă cât este afișat `alert`"
130+
În majoritatea browserelor, inclusiv Chrome și Firefox, cronometrul intern continuă să "ticăie" în timp ce se afișează `alert/confirm/prompt`.
131131

132-
So if you run the code above and don't dismiss the `alert` window for some time, then the next `alert` will be shown immediately as you do it. The actual interval between alerts will be shorter than 2 seconds.
132+
Deci dacă executați codul de mai sus și nu închideți fereastra `alert` pentru o perioadă de timp, atunci următorul `alert` va fi afișat imediat ce o faceți. Intervalul real dintre alerte va fi mai scurt de 2 secunde.
133133
```
134134
135-
## Nested setTimeout
135+
## setTimeout inbricat
136136
137-
There are two ways of running something regularly.
137+
Există două modalități de a rula ceva în mod regulat.
138138
139-
One is `setInterval`. The other one is a nested `setTimeout`, like this:
139+
Una dintre ele este `setInterval`. Cealaltă este un `setTimeout` imbricate, ca acesta:
140140
141141
```js
142-
/** instead of:
142+
/** în loc de:
143143
let timerId = setInterval(() => alert('tick'), 2000);
144144
*/
145145
@@ -151,11 +151,11 @@ let timerId = setTimeout(function tick() {
151151
}, 2000);
152152
```
153153

154-
The `setTimeout` above schedules the next call right at the end of the current one `(*)`.
154+
`setTimeout` de mai sus planifică următorul apel chiar la sfârșitul celui curent `(*)`.
155155

156-
The nested `setTimeout` is a more flexible method than `setInterval`. This way the next call may be scheduled differently, depending on the results of the current one.
156+
Metoda imbricată `setTimeout` este mai flexibilă decât `setInterval`. În acest fel următorul apel poate fi planificat diferit, în funcție de rezultatele apelului curent.
157157

158-
For instance, we need to write a service that sends a request to the server every 5 seconds asking for data, but in case the server is overloaded, it should increase the interval to 10, 20, 40 seconds...
158+
De exemplu, trebuie să scriem un serviciu care să trimită o solicitare către server la fiecare 5 secunde pentru a cere date, dar în cazul în care serverul este supraîncărcat, ar trebui să crească intervalul la 10, 20, 40 de secunde...
159159

160160
Here's the pseudocode:
161161
```js

0 commit comments

Comments
 (0)