brick-storage-indexeddb
Demo
Usage
Import Web Components polyfill:
<script src="bower_components/platform/platform.js"></script>
Import Custom Element:
<link rel="import" href="src/brick-storage-indexeddb.html">
Start using it:
<brick-storage-indexeddb></brick-storage-indexeddb>
Options
Attribute | Options | Default | Description |
---|---|---|---|
name |
string | storage |
The database name. |
keyname |
string | id |
The name of the unique primary key to use for get, set and remove operations. Defaults to an auto-incrementing id . |
indexname |
string | One or multiple indices which can be used to order and the results of queries which return multiple items. |
Methods
Method | Returns a promise for | Description |
---|---|---|
insert(object) |
key of the saved object | Insert an object. |
set(object) |
key of the saved object | Insert/upate an object. |
setMany(objects) |
- | Insert/upate multiple objects. |
get(key) |
object | Retrieves the object with the key. |
remove(key) |
undefined | Deletes the object with the key. |
getMany(options) |
array multiple objects | Retrieves multiple stored objects. If no filtering options are provided, it returns all objects.
|
size() |
number of stored items | Returns the number of stored objects. |
clear() |
undefined | Deletes all database entries. |
Development
In order to run it locally you'll need to fetch some dependencies and a basic server setup.
-
$ npm install -g bower gulp
Install local dependencies:
$ bower install && npm install
To test the project, start the development server and open
http://localhost:3001
.$ gulp server
To build the css and lint the scripts.
$ gulp build
To provide a live demo, send everything to
gh-pages
branch.$ gulp deploy