Skip to content

Commit afb8e58

Browse files
committed
Add more docs.
1 parent 676c773 commit afb8e58

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The official ArangoDB low-level JavaScript client.
1010

1111
The driver is being tested with ArangoDB 2.5, 2.6 and 2.7 using Node.js 0.12, 4.2 and stable. Versions outside of this range may be compatible but are not officially supported.
1212

13+
As of version 4.0.0 of this driver, a minified standalone browser bundle is also available.
14+
1315
# Install
1416

1517
## With NPM
@@ -18,6 +20,12 @@ The driver is being tested with ArangoDB 2.5, 2.6 and 2.7 using Node.js 0.12, 4.
1820
npm install arangojs
1921
```
2022

23+
## With bower
24+
25+
```sh
26+
bower install arangojs
27+
```
28+
2129
## From source
2230

2331
```sh
@@ -27,6 +35,25 @@ npm install
2735
npm run dist
2836
```
2937

38+
# Basic usage example
39+
40+
```js
41+
// ES2015-style
42+
import arangojs, {Database, aqlQuery} from 'arangojs';
43+
let db1 = arangojs(); // convenience short-hand
44+
let db2 = new Database();
45+
let {query, bindVars} = aqlQuery`RETURN ${Date.now()}`;
46+
47+
// or plain old Node-style
48+
49+
var arangojs = require('arangojs');
50+
var db1 = arangojs();
51+
var db2 = new arangojs.Database();
52+
var aql = arangojs.aqlQuery(['RETURN ', ''], Date.now());
53+
var query = aql.query;
54+
var bindVars = aql.bindVars;
55+
```
56+
3057
# API
3158

3259
All asynchronous functions take an optional node-style callback (or "errback") with the following arguments:
@@ -86,16 +113,20 @@ If *config* is a string, it will be interpreted as *config.url*.
86113

87114
* **agent**: `Agent` (optional)
88115

89-
An http Agent instance to use for connections. This has no effect in the browser.
116+
An http Agent instance to use for connections.
117+
118+
By default a new [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) (or https.Agent) instance will be created using the *agentOptions*.
90119

91-
By default a new [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) instance will be created using the *agentOptions*.
120+
This option has no effect when using the browser version of arangojs.
92121

93122
* **agentOptions**: `Object` (Default: see below)
94123

95-
An object with options for the agent. This will be ignored if *agent* is also provided and has no effect in the browser.
124+
An object with options for the agent. This will be ignored if *agent* is also provided.
96125

97126
Default: `{maxSockets: 3, keepAlive: true, keepAliveMsecs: 1000}`.
98127

128+
In the browser version of arangojs this option can be used to pass additional options to the underlying calls of the [`xhr`](https://www.npmjs.com/package/xhr) module. The options `keepAlive` and `keepAliveMsecs` have no effect in the browser but `maxSockets` will still be used to limit the amount of parallel requests made by arangojs.
129+
99130
* **promise**: `Class` (optional)
100131

101132
The `Promise` implementation to use or `false` to disable promises entirely.

0 commit comments

Comments
 (0)