This commit is contained in:
Ilya Kantor 2019-07-09 04:09:08 +03:00
parent d1c2c4c082
commit 89f1604e7b
2 changed files with 5 additions and 1 deletions

View file

@ -296,7 +296,7 @@ There are two notable differences of external module scripts:
<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
<!-- another-site.com must supply Access-Control-Allow-Origin -->
<!-- otherwise, the script won't execute -->

View file

@ -209,11 +209,15 @@ For instance, these are all perfectly valid default exports:
export default class { // no class name
constructor() { ... }
}
```
```js
export default function(user) { // no function name
alert(`Hello, ${user}!`);
}
```
```js
// export a single value, without making a variable
export default ['Jan', 'Feb', 'Mar','Apr', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
```