Skip to content
Permalink
Browse files

manual - import.meta.main (#1868)

  • Loading branch information...
bartlomieju authored and ry committed Mar 2, 2019
1 parent bf95acf commit 39ed9759113bc6cd3746020b611e1b6833b53f1a
Showing with 3 additions and 3 deletions.
  1. +3 −3 website/manual.md
@@ -472,11 +472,11 @@ software, centralized code repositories, and superfluous file formats.

### Testing if current file is the main program

By using `window.location` and `import.meta.url` one can test if the current
script has been executed as the main input to the program.
To test if the current script has been executed as the main input to the program
check `import.meta.main`.

```ts
if (window.location.toString() == import.meta.url) {
if (import.meta.main) {
console.log("main");
}
```

0 comments on commit 39ed975

Please sign in to comment.
You can’t perform that action at this time.