/utils/userIndexedDB
The module exports methods to store and retrieve objects from a userIndexedDB.
- Source
Methods
(inner) add(params) → {Promise}
The add method will add new records to the userIndexedDB.
| Name | Type | Description |
|---|---|---|
params | Object |
| Name | Type | Description |
|---|---|---|
params.store | string | Identifier for the object store in the userIndexedDB. |
params.obj | object | Object to be stored in the userIndexedDB store. |
- Source
addPromise
- Type:
- Promise
(inner) get(params) → {Promise}
The get method will retrieve records from the userIndexedDB.
| Name | Type | Description |
|---|---|---|
params | Object | 10941 user |
| Name | Type | Description |
|---|---|---|
params.store | string | Identifier for the object store in the userIndexedDB. |
params.name | object | The key of the record to retrieve. |
- Source
getPromise
- Type:
- Promise
(inner) list(params) → {Promise}
The list method will retrieve all records from the userIndexedDB store.
| Name | Type | Description |
|---|---|---|
params | Object |
| Name | Type | Description |
|---|---|---|
params.store | string | Identifier for the object store in the userIndexedDB. |
- Source
getPromise
- Type:
- Promise
(inner) openDB(params, versionopt) → {Promise}
The method is called from any transaction method to interact with the userIndexedDB.
A new database will be created when attempting to open a DB which does not exist.
The name for the userIndexedDB database can be set with the indexedDB parameter or will default to the mapp.user.title property or "MAPP" if the user title is not defined. This is to ensure that different XYZ environments running on the same host will have separate userIndexedDB databases.
A new store will be created when a new DB is upgraded [on creation].
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
params | object | |||
version | integer | <optional> | 3 | The version number for the userIndexedDB. Incremented when a new store needs to be created. |
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
params.store | string | The name of the object store to interact with. | ||
params.indexedDB | string | <optional> | "MAPP" | The name of the userIndexedDB database to open. |
- Source
OpenDBPromise
- Type:
- Promise
(inner) put(params) → {Promise}
The put method will update existing records or add new records to the userIndexedDB.
| Name | Type | Description |
|---|---|---|
params | Object |
| Name | Type | Description |
|---|---|---|
params.name | string | The key of the record to update or add. |
params.store | string | The name of the object store in the userIndexedDB. |
params.obj | object | The object to be stored in the userIndexedDB store. |
- Source
updatePromise
- Type:
- Promise
(inner) remove(params) → {Promise}
The remove method will delete records from the userIndexedDB.
| Name | Type | Description |
|---|---|---|
params | Object |
| Name | Type | Description |
|---|---|---|
params.name | string | The key of the record to remove. |
params.store | string | The name of the object store in the userIndexedDB. |
- Source
removePromise
- Type:
- Promise