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
@@ -26,25 +26,25 @@ For instance, here all exports are valid:
26
26
```
27
27
28
28
````smart header="No semicolons after export class/function"
29
-
Please note that `export` before a class or a function does not make it a [function expression](info:function-expressions-arrows). It's still a function declaration, albeit exported.
29
+
Unutmayın ki, bir sınıf veya fonksyiondan önce `export` bir [işlev ifadeleri](info:function-expressions-arrows) yapmaz. Dışarıya aktarılmasına rağmen hala bir işlev bildirgesidir.
30
30
31
-
Most JavaScript style guides recommend semicolons after statements, but not after function and class declarations.
31
+
Javascript stil kılavuzlarının çoğu ifadelerden sonra noktalı birgül önermektedir ama işlev ve sınıf bildirimlerinden sonra değil.
32
32
33
-
That's why there should be no semicolons at the end of `export class` and `export function`.
33
+
Bu nedenle `export class` ve `export function` sonuna noktalı virgül konuşmamalıdır..
34
34
35
35
```js
36
36
export function sayHi(user) {
37
37
alert(`Hello, ${user}!`);
38
-
} *!* // no ; at the end */!*
38
+
} *!* // sonunda ; yok */!*
39
39
```
40
40
41
41
````
42
42
43
-
## Export apart from declarations
43
+
## Bildirimlerden ayrı dışa aktarma
44
44
45
-
Also, we can put `export`separately.
45
+
Ayrıca, `export`ayrı ayrı koyabiliriz.
46
46
47
-
Here we first declare, and then export:
47
+
Burada önce bildirir sonra dışarıya aktarırız:
48
48
49
49
```js
50
50
// 📁 say.js
@@ -57,15 +57,15 @@ function sayBye(user) {
57
57
}
58
58
59
59
*!*
60
-
export {sayHi, sayBye}; //a list of exported variables
...Or, technically we could put `export`above functions as well.
64
+
...Veya teknik olarak `export`fonksiyonların üstüne koyabiliriz.
65
65
66
-
## Import *
66
+
## İmport *
67
67
68
-
Usually, we put a list of what to import into `import {...}`, like this:
68
+
Genelde, `import {...}` içine neyin içine aktarılacağını içeren bir liste koyarız, şöyle:
69
69
70
70
```js
71
71
// 📁 main.js
@@ -77,7 +77,7 @@ sayHi('John'); // Hello, John!
77
77
sayBye('John'); // Bye, John!
78
78
```
79
79
80
-
But if the list is long, we can import everything as an object using `import * as <obj>`, for instance:
80
+
Ama liste uzunsa, `import * as <obj>` kullanarak her şeyi nesne olarak alabiliriz, örneğin:
81
81
82
82
```js
83
83
// 📁 main.js
@@ -89,29 +89,29 @@ say.sayHi('John');
89
89
say.sayBye('John');
90
90
```
91
91
92
-
At first sight, "import everything" seems such a cool thing, short to write, why should we ever explicitly list what we need to import?
92
+
İlk bakışta, "her şeyi dahil etmek" kısa yazıldığı için güzel gözüküyor. İçeriye aktarmamız için neye ihtiyaç varsa neden açıkça listeleyelim?
93
93
94
-
Well, there are few reasons.
94
+
Bunun bir kaç nedeni var.
95
95
96
-
1. Modern build tools ([webpack](http://webpack.github.io)and others) bundle modules together and optimize them to speedup loading and remove unused stuff.
96
+
1. Modern derleme araçları ([webpack](http://webpack.github.io)ve diğerleri) modülleri bir araya getirir ve kullanılmasını önleyen yükleme işlemlerini hızlandırmak ve kaldırmak için optimize eder.
97
97
98
-
Let's say, we added a 3rd-party library `lib.js`to our project with many functions:
98
+
Diyelim ki, birçok fonksiyona sahip projemize 3. parti bir kütüphane `lib.js`ekledik.
99
99
```js
100
100
// 📁 lib.js
101
101
exportfunctionsayHi() { ... }
102
102
exportfunctionsayBye() { ... }
103
103
exportfunctionbecomeSilent() { ... }
104
104
```
105
105
106
-
Now if we only use one of`lib.js`functions in our project:
106
+
Şimdi projemizde `lib.js`fonksiyonlarından sadece birini kullanırsak
107
107
```js
108
108
// 📁 main.js
109
109
import {sayHi} from './lib.js';
110
110
```
111
-
...Then the optimizer will automatically detect it and totally remove the other functions from the bundled code, thus making the build smaller. That is called "tree-shaking".
111
+
...Ardından optimizer otomatik olarak algılar ve diğer işlevleri birlikte verilen koddan tamamen kaldırır, böylece yapı daha küçük hale gelir. Buna"tree-shaking" denilir.
112
112
113
-
2.Explicitly listing what to import gives shorter names: `sayHi()`instead of `lib.sayHi()`.
114
-
3.Explicit imports give better overview of the code structure: what is used and where. It makes code support and refactoring easier.
113
+
2.Açıkça listelemek ne içeri aktarılacaksa daha kısa isimler verilir:`lib.sayHi()`yerine `sayHi()`.
114
+
3.Açıkça dahil etmek kod kod yapısında daha iyi genel bakışı sağlar: Nerede, ne kullanılır. Kod desteğini ve yeniden düzenlemeyi kolaylaştırır.
0 commit comments