Andy Pack
5f04cacd81
Affected files: .obsidian/workspace.json Projects/Dev Options.md Projects/Mixonomer.md Projects/NoteCrawler.md Projects/Selector.md Projects/To Do App.md STEM/CS/ABI.md STEM/CS/Calling Conventions.md STEM/CS/Code Types.md STEM/CS/Compilers.md STEM/CS/ISA.md STEM/CS/Language Binding.md STEM/CS/Languages/Assembly.md STEM/CS/Languages/C++.md STEM/CS/Languages/Javascript.md STEM/CS/Languages/Python.md STEM/CS/Languages/Rust.md STEM/CS/Languages/dotNet.md STEM/IOT/OS/Composition.md
34 lines
692 B
Markdown
34 lines
692 B
Markdown
---
|
|
tags:
|
|
- web
|
|
- dev
|
|
---
|
|
[https://www.learnui.design/blog/spice-up-designs.html](https://www.learnui.design/blog/spice-up-designs.html)
|
|
|
|
# Modules
|
|
- For splitting files
|
|
|
|
## import
|
|
`import defaultExport from "module-name";`
|
|
`import { export1, export2 } from "module-name";`
|
|
|
|
- Read-only live bindings
|
|
- Exported from another module
|
|
- Come in strict mode
|
|
|
|
### Dynamic Import
|
|
- Conditionally or on demand
|
|
|
|
`import('/modules/module.js')`
|
|
`.then((module) => {`
|
|
`// Do something`
|
|
`});`
|
|
|
|
`let module = await import('/modules/module.js');`
|
|
|
|
## Export
|
|
- Stick in front of statements
|
|
|
|
`export const name = 'square';`
|
|
`export function …`
|
|
`export { name, draw, reportArea, reportPerimeter };` |