Skip to content

Dynamic imports #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 7, 2019
Merged
Prev Previous commit
Next Next commit
Dynamic imports translated
  • Loading branch information
lhmisho committed Oct 24, 2019
commit 80b37ec1094c880aa149061b326e2005fcbad074
14 changes: 7 additions & 7 deletions 1-js/13-modules/03-modules-dynamic-imports/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let modulePath = prompt("কোন মডিউলটি লোড করতে

import(modulePath)
.then(obj => <module object>)
.catch(err => <loading error, e.g. যদি কোন মডিউল না থাকে>)
.catch(err => <loading এরর, যদি কোন মডিউল না থাকে>)
```

অথবা, যদি এটি একটি `async` ফাংশনের ভিতর হয়ে থাকে তবে `let module = await import(modulePath)` ব্যবহার করতে পারি।
Expand Down Expand Up @@ -74,26 +74,26 @@ export default function() {
}
```

...Then, in order to access it, we can use `default` property of the module object:
...তারপর এটাকে এক্সেস করার জন্য আমরা মডিউল অব্জেক্টের `default` প্রপার্টি ব্যাবহার করতে পারি।

```js
let obj = await import('./say.js');
let say = obj.default;
// or, in one line: let {default: say} = await import('./say.js');
// অথাবা, এক লাইনে: let {default: say} = await import('./say.js');

say();
```

Here's the full example:
এখানে সম্পূর্ণ উদাহারনটি রয়েছেঃ

[codetabs src="say" current="index.html"]

```smart
Dynamic imports work in regular scripts, they don't require `script type="module"`.
রেগুলার স্ক্রিপ্টে ডাইনামিক ইমপোর্ট কাজ করে, তার জন্য `script type="module" প্রয়োজন হয় না।
```

```smart
Although `import()` looks like a function call, it's a special syntax that just happens to use parentheses (similar to `super()`).
যদিও `import()` দেখতে ফাংশন কলের মতো, কিন্তু এটি একটি (`super()` মতো) বিশেষ সিন্টেক্স যার জন্য "parentheses" ব্যবহার করতে হয়।

So we can't copy `import` to a variable or use `call/apply` with it. That's not a function.
তাই আমারা `import` কে কোন ভেরিয়েবলে কপি অথবা `call/apply` করা যায় না।
```