Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

Commit ee3a41b

Browse files
author
Lars-Magnus Skog
authored
Document constructor (#119)
* Document constructor * tweak location docs * update options.prefix docs * update location docs once more
1 parent 2a8526c commit ee3a41b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ Not to be confused with [leveljs](https://www.npmjs.com/package/leveljs).
5858

5959
This library is best used with [browserify](http://browserify.org).
6060

61+
## API
62+
63+
### `db = leveljs(location[, options])`
64+
Returns a new `leveljs` instance. `location` is the string name of the [`IDBDatabase`](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) to be opened, as well as the object store within that database. The database name will be prefixed with `options.prefix`.
65+
66+
#### `options`
67+
68+
The optional `options` argument may contain:
69+
70+
* `prefix` *(string, default: `'level-js-'`)*: Prefix for `IDBDatabase` name.
71+
* `version` *(string | number, default: `1`)*: The version to open the database with.
72+
73+
See [`IDBFactory#open`](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open) for more details.
74+
6175
## Running Tests
6276

6377
```sh

0 commit comments

Comments
 (0)