minor
This commit is contained in:
parent
d1c2c4c082
commit
89f1604e7b
2 changed files with 5 additions and 1 deletions
|
@ -296,7 +296,7 @@ There are two notable differences of external module scripts:
|
||||||
<script type="module" src="my.js"></script>
|
<script type="module" src="my.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
2. External scripts that are fetched from another domain require [CORS](mdn:Web/HTTP/CORS) headers. In other words, if a module script is fetched from another domain, the remote server must supply a header `Access-Control-Allow-Origin: *` (may use fetching domain instead of `*`) to indicate that the fetch is allowed.
|
2. External scripts that are fetched from another origin (e.g. another site) require [CORS](mdn:Web/HTTP/CORS) headers, as described in the chapter <info:fetch-crossorigin>. In other words, if a module script is fetched from another origin, the remote server must supply a header `Access-Control-Allow-Origin: *` (may use site domain instead of `*`) to indicate that the fetch is allowed.
|
||||||
```html
|
```html
|
||||||
<!-- another-site.com must supply Access-Control-Allow-Origin -->
|
<!-- another-site.com must supply Access-Control-Allow-Origin -->
|
||||||
<!-- otherwise, the script won't execute -->
|
<!-- otherwise, the script won't execute -->
|
||||||
|
|
|
@ -209,11 +209,15 @@ For instance, these are all perfectly valid default exports:
|
||||||
export default class { // no class name
|
export default class { // no class name
|
||||||
constructor() { ... }
|
constructor() { ... }
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
export default function(user) { // no function name
|
export default function(user) { // no function name
|
||||||
alert(`Hello, ${user}!`);
|
alert(`Hello, ${user}!`);
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
// export a single value, without making a variable
|
// export a single value, without making a variable
|
||||||
export default ['Jan', 'Feb', 'Mar','Apr', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
export default ['Jan', 'Feb', 'Mar','Apr', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue