Skip to content

Commit 841b921

Browse files
authored
Update article.md
1 parent d339746 commit 841b921

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

2-ui/99-ui-misc/03-event-loop/article.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -221,25 +221,25 @@ Bu daha güzel görünüyor:
221221

222222
Bir olay işleyicide, bazı eylemleri olay kabarıp tüm seviyelerde işlenene kadar ertelemeye karar verebiliriz. Bunu, kodu sıfır gecikmeli `setTimeout` içine sararak yapabiliriz.
223223

224-
<info:dispatch-events> bölümünde bir örnek gördük: `menu-open` özel olayı(custom event) `setTimeout` içinde gönderilir, böylece click" olayı tamamen işlendikten sonra gerçekleşir.
224+
<bilgi:olayları gönderme(dispatch-events)> bölümünde bir örnek gördük: `menu-open` özel olayı(custom event) `setTimeout` içinde gönderilir, böylece "click" olayı tamamen işlendikten sonra gerçekleşir.
225225

226226
```js
227227
menu.onclick = function() {
228228
// ...
229229

230-
// create a custom event with the clicked menu item data
230+
// tıklanan menü öğesi verileriyle özel bir olay oluşturun
231231
let customEvent = new CustomEvent("menu-open", {
232232
bubbles: true
233233
});
234234

235-
// dispatch the custom event asynchronously
235+
// özel olayı eşzamansız(asynchronously) olarak gönder
236236
setTimeout(() => menu.dispatchEvent(customEvent));
237237
};
238238
```
239239

240240
## Macrotasks ve Microtasks
241241

242-
Bu bölümde açıklanan *macrotasks* ile birlikte, <info:microtasks-sırası> bölümünde bahsedilen *microtasks* vardır.
242+
Bu bölümde açıklanan *macrotask*'ler ile birlikte, <bilgi:microtasks-sırası> bölümünde bahsedilen *microtask*'ler vardır.
243243

244244
Microtask'ler yalnızca kodumuzdan gelir. Genellikle promise'larla oluşturulurlar: `.then/catch/finally` işleyicisinin yürütülmesi bir microtask haline gelir. Microtask'ler, bir başka promise işleme biçimi olduğu için, `wait`'in "örtüsü altında" da kullanılır.
245245

@@ -258,23 +258,24 @@ Promise.resolve()
258258
alert("code");
259259
```
260260

261-
What's going to be the order here?
261+
Buradaki sıra ne olacak?
262262

263-
1. `code` shows first, because it's a regular synchronous call.
264-
2. `promise` shows second, because `.then` passes through the microtask queue, and runs after the current code.
265-
3. `timeout` shows last, because it's a macrotask.
263+
1. Sıradan bir eşzamanlı(synchronous) çağrı olduğu için önce `kod` gösterilir.
264+
2. `promise` ikinci sıradadır, çünkü `.then` microtask kuyruğundan geçer ve geçerli koddan sonra çalışır.
265+
3. `timeout`'u en son gösterir, çünkü bu bir macrotask'dir.
266266

267-
The richer event loop picture looks like this (order is from top to bottom, that is: the script first, then microtasks, rendering and so on):
267+
Daha zengin olay döngüsü resmi şöyle görünür (sıra yukarıdan aşağıya doğrudur, yani: önce script, ardından microtask'ler, oluşturma(rendering) vb.):
268268

269269
![](eventLoop-full.svg)
270270

271-
All microtasks are completed before any other event handling or rendering or any other macrotask takes place.
271+
Tüm microtask'ler, başka herhangi bir olay işleme(handling) veya oluşturma(rendering) veya başka herhangi bir macrotask gerçekleşmeden önce tamamlanır.
272272

273-
That's important, as it guarantees that the application environment is basically the same (no mouse coordinate changes, no new network data, etc) between microtasks.
273+
Uygulama ortamının microtask'ler arasında temelde aynı olmasını (fare koordinat değişikliği yok, yeni ağ verisi yok, vb.) garanti ettiği için bu önemlidir.
274274

275-
If we'd like to execute a function asynchronously (after the current code), but before changes are rendered or new events handled, we can schedule it with `queueMicrotask`.
275+
Bir fonksiyonu eşzamansız(asynchronously) olarak (geçerli koddan sonra) yürütmek istiyorsak, ancak değişiklikler oluşturulmadan(rendered) veya yeni olaylar işlenmeden(handled) önce, bunu `queueMicrotask` ile zamanlayabiliriz.
276276

277277
Here's an example with "counting progress bar", similar to the one shown previously, but `queueMicrotask` is used instead of `setTimeout`. You can see that it renders at the very end. Just like the synchronous code:
278+
Burada, daha önce gösterilene benzer bir "sayan ilerleme çubuğu" örneği verilmiştir, ancak `setTimeout` yerine `queueMicrotask` kullanılmıştır. En sonunda oluştuğunu(render) görebilirsiniz. Tıpkı senkron kod gibi:
278279

279280
```html run
280281
<div id="progress"></div>
@@ -284,7 +285,7 @@ Here's an example with "counting progress bar", similar to the one shown previou
284285
285286
function count() {
286287
287-
// do a piece of the heavy job (*)
288+
// ağır işin bir parçasını yap (*)
288289
do {
289290
i++;
290291
progress.innerHTML = i;
@@ -302,39 +303,39 @@ Here's an example with "counting progress bar", similar to the one shown previou
302303
</script>
303304
```
304305

305-
## Summary
306+
## Özet
306307

307-
A more detailed event loop algorithm (though still simplified compared to the [specification](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model)):
308+
Daha ayrıntılı bir olay döngüsü algoritması (yine de [spesifikasyona](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model) kıyasla basitleştirilmiş olsa da):
308309

309-
1. Dequeue and run the oldest task from the *macrotask* queue (e.g. "script").
310-
2. Execute all *microtasks*:
311-
- While the microtask queue is not empty:
312-
- Dequeue and run the oldest microtask.
313-
3. Render changes if any.
314-
4. If the macrotask queue is empty, wait till a macrotask appears.
315-
5. Go to step 1.
310+
1. En eski görevi *macrotask* kuyruğundan ayırın ve çalıştırın (ör. "script").
311+
2. Tüm *microtask*'leri yürütün:
312+
- Microtask kuyruğu boş değilken:
313+
- En eski microtask'i sıraya alın ve çalıştırın.
314+
3. Varsa oluşturme(render) değişiklikleri.
315+
4. Macrotask kuyruğu boşsa, bir macrotask görünene kadar bekleyin.
316+
5. 1.Adıma gidin.
316317

317-
To schedule a new *macrotask*:
318-
- Use zero delayed `setTimeout(f)`.
318+
Yeni bir *macrotask* zamanlamak için:
319+
- Sıfır gecikmeli `setTimeout(f)` kullanın.
319320

320-
That may be used to split a big calculation-heavy task into pieces, for the browser to be able to react to user events and show progress between them.
321+
Bu, tarayıcının kullanıcı olaylarına tepki verebilmesi ve aralarındaki ilerlemeyi gösterebilmesi için büyük bir hesaplama ağırlıklı görevi parçalara ayırmak için kullanılabilir.
321322

322-
Also, used in event handlers to schedule an action after the event is fully handled (bubbling done).
323+
Ayrıca, olay tamamen işlendikten (köpürme işlemi) sonra bir eylem zamanlamak için olay işleyicilerinde kullanılır.
323324

324-
To schedule a new *microtask*
325-
- Use `queueMicrotask(f)`.
326-
- Also promise handlers go through the microtask queue.
325+
Yeni bir *microtask* planlamak için
326+
- `queueMicrotask(f)` kullanın.
327+
- Ayrıca promise işleyicileri microtask kuyruğundan geçer.
327328

328-
There's no UI or network event handling between microtasks: they run immediately one after another.
329+
Microtask'ler arasında UI veya ağ olayı işleme yoktur: Bunlar birbiri ardına hemen çalışır.
329330

330-
So one may want to `queueMicrotask` to execute a function asynchronously, but within the environment state.
331+
Bu nedenle, bir fonksiyonu eşzamansız(asynchronously) olarak ancak ortam durumu içinde yürütmek için `queueMicrotask` isteyebilirsiniz.
331332

332333
```smart header="Web Workers"
333-
For long heavy calculations that shouldn't block the event loop, we can use [Web Workers](https://html.spec.whatwg.org/multipage/workers.html).
334+
Olay döngüsünü engellememesi gereken uzun ağır hesaplamalar için [Web Workers](https://html.spec.whatwg.org/multipage/workers.html)'ı kullanabiliriz.
334335
335-
That's a way to run code in another, parallel thread.
336+
Bu, başka bir paralel iş parçacığında(thread) kod çalıştırmanın bir yoludur.
336337
337-
Web Workers can exchange messages with the main process, but they have their own variables, and their own event loop.
338+
Web Workers ana süreçle mesaj alışverişinde bulunabilirler, ancak kendi değişkenleri ve kendi olay döngüleri vardır.
338339
339-
Web Workers do not have access to DOM, so they are useful, mainly, for calculations, to use multiple CPU cores simultaneously.
340+
Web Worker'larının DOM'a erişimi yoktur, bu nedenle, esas olarak hesaplamalar için, aynı anda birden fazla CPU çekirdeği kullanmak için yararlıdırlar.
340341
```

0 commit comments

Comments
 (0)