Skip to content

Commit bb8346d

Browse files
committed
Update browser info
1 parent 5c907a4 commit bb8346d

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

README.md

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,29 @@ yarn add arangojs
3030
When using modern JavaScript tooling with a bundler and compiler (e.g. Babel),
3131
arangojs can be installed using `npm` or `yarn` like any other dependency.
3232

33-
For use without a compiler, the npm release comes with a precompiled browser
34-
build for evergreen browsers:
35-
36-
```js
37-
var arangojs = require("arangojs/web");
38-
```
39-
40-
You can also use [unpkg](https://unpkg.com) during development:
33+
You can also use [jsDelivr CDN](https://www.jsdelivr.com) during development:
4134

4235
```html
43-
< !-- note the path includes the version number (e.g. 8.0.0) -- >
44-
<script src="https://unpkg.com/[email protected]/web.js"></script>
45-
<script>
46-
var db = new arangojs.Database();
36+
<script type="importmap">
37+
{
38+
"imports": {
39+
"arangojs": "https://cdn.jsdelivr.net/npm/[email protected]/esm/index.js?+esm"
40+
}
41+
}
42+
</script>
43+
<script type="module">
44+
import { Database } from "arangojs";
45+
const db = new Database();
4746
// ...
4847
</script>
4948
```
5049

51-
When loading the browser build with a script tag make sure to load the polyfill first:
52-
53-
```html
54-
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.js"></script>
55-
<script src="https://unpkg.com/[email protected]/web.js"></script>
56-
```
57-
5850
## Basic usage example
5951

60-
Modern JavaScript/TypeScript with async/await:
52+
Modern JavaScript/TypeScript with async/await and ES Modules:
6153

6254
```js
63-
// TS: import { Database, aql } from "arangojs";
64-
const { Database, aql } = require("arangojs");
55+
import { Database, aql } from "arangojs";
6556

6657
const db = new Database();
6758
const Pokemons = db.collection("my-pokemons");
@@ -98,7 +89,7 @@ const db = new Database({
9889
db.useBasicAuth("admin", "maplesyrup");
9990
```
10091

101-
Old-school JavaScript with promises:
92+
Old-school JavaScript with promises and CommonJS:
10293

10394
```js
10495
var arangojs = require("arangojs");
@@ -291,7 +282,7 @@ internally, you can override the global agent by adding `undici` as a
291282
dependency to your project and using its `setGlobalDispatcher` as follows:
292283

293284
```js
294-
const { Agent, setGlobalDispatcher } = require("undici");
285+
import { Agent, setGlobalDispatcher } from "undici";
295286

296287
setGlobalDispatcher(
297288
new Agent({
@@ -308,7 +299,7 @@ HTTPS certificate validation entirely, but note this has
308299
**extremely dangerous** security implications:
309300

310301
```js
311-
const { Agent, setGlobalDispatcher } = require("undici");
302+
import { Agent, setGlobalDispatcher } from "undici";
312303

313304
setGlobalDispatcher(
314305
new Agent({

0 commit comments

Comments
 (0)