Skip to content

Commit 19324f4

Browse files
authored
dinamik import çevirisi bitti.
1 parent 77585a3 commit 19324f4

File tree

1 file changed

+20
-20
lines changed
  • 1-js/13-modules/03-modules-dynamic-imports

1 file changed

+20
-20
lines changed
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
11

2-
# Dynamic imports
2+
# Dinamik İçeriye Aktarma
33

4-
Export and import statements that we covered in previous chapters are called "static".
4+
Önceki bölümlerde ele aldığımız ifadelere içeri aktarım ve dışa aktarım ifadelerine "statik" denir.
55

6-
That's because they are indeed static. The syntax is very strict.
6+
Çünkü onlar gerçekten statik. Sözdizimi çok katıdır.
77

8-
First, we can't dynamically generate any parameters of `import`.
8+
Birincisi, dinamik olarak `import` parametresini oluşturamıyoruz.
99

10-
The module path must be a primitive string, can't be a function call. This won't work:
10+
Modül yolu ilkel bir dize olmalı ve işlev çağrısı olamaz. Bu çalışmayacaktır:
1111

1212
```js
13-
import ... from *!*getModuleName()*/!*; // Error, only from "string" is allowed
13+
import ... from *!*getModuleName()*/!*; // Hata, sadece "string"den izin verilir.
1414
```
1515

16-
Second, we can't import conditionally or at run-time:
16+
İkincisi, koşullu veya çalışma zamanında içe aktaramıyoruz:
1717

1818
```js
1919
if(...) {
20-
import ...; // Error, not allowed!
20+
import ...; // Hata, izin verilmiyor!
2121
}
2222

2323
{
24-
import ...; // Error, we can't put import in any block
24+
import ...; // Hata, içe aktarma işlemini herhangi bir bloğa koyamıyoruz.
2525
}
2626
```
2727

28-
That's because, import/export aim to provide a backbone for the code structure. That's a good thing, as code structure can be analyzed, modules can be gathered and bundled together, unused exports can be removed (tree-shaken). That's possible only because everything is fixed.
28+
Çünkü import/export kod yapısı için omurga sağlamayı hedefleriyor. Bu iyi bir şey, Kod yapısı analiz edilebildiğinden modüller toplanabilir ve birlikte paketlenebilir, kullanılmayan dışa aktarımlar kaldırılabilir (tree-shaken). Bu mümkün çünkü her şey sabit.
2929

30-
But how do we import a module dynamically, on-demand?
3130

32-
## The import() function
31+
Ancak bir modülü dinamik ve isteğe bağlı olarak nasıl içeriye aktarırız?
3332

34-
The `import(module)` function can be called from anywhere. It returns a promise that resolves into a module object.
33+
## import() Fonksiyonu
3534

36-
The usage pattern looks like this:
35+
`import(module)` fonksiyonu her yerden çağrılabilir. Bir modül nesnesine çözümlenen bir söz verir.
3736

37+
Kullanım şekli şöyle görünür:
3838
```js run
3939
let modulePath = prompt("Module path?");
4040

4141
import(modulePath)
42-
.then(obj => <module object>)
43-
.catch(err => <loading error, no such module?>)
42+
.then(obj => <modül nesnesi>)
43+
.catch(err => <yükleme hatası, böyle bir modül yok?>)
4444
```
4545
46-
Or, we could use `let module = await import(modulePath)` if inside an async function.
46+
Veya bir zaman async işlevi içindeyse `let module = await import(modulePath)` kullanabiliriz
4747
48-
Like this:
48+
Bunun gibi:
4949
5050
[codetabs src="say" current="index.html"]
5151
52-
So, dynamic imports are very simple to use.
52+
Bu nedenle dinamik içe aktarım kullanımı çok basittir.
5353
54-
Also, dynamic imports work in regular scripts, they don't require `script type="module"`.
54+
Ayrıca dinamik içeri aktarımlar düzenli komut dosyalarında çalışır, `script type="module"` gerektirmezler.

0 commit comments

Comments
 (0)