Skip to content

Commit

Permalink
docs: modern js usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Jul 11, 2024
1 parent 0ea3a8b commit 649bbb4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ javascript:(function () { var script = document.createElement('script'); script.
You can get it on npm.

```bash
npm install eruda --save
npm install eruda --save-dev
```

Add this script to your page.
Expand Down Expand Up @@ -86,6 +86,14 @@ The JavaScript file size is quite huge(about 100kb gzipped) and therefore not su
})();
```

If you are using modern JavaScript tooling, you can dynamically import it.

```javascript
if (import.meta.env.MODE === 'development') {
import('eruda').then(eruda => eruda.default.init());
}
```
## Configuration
When initialization, a configuration object can be passed in.
Expand Down

0 comments on commit 649bbb4

Please sign in to comment.