/utils/userIndexedDB

The module exports methods to store and retrieve objects from a userIndexedDB.

Methods

(inner) add(params) → {Promise}

The add method will add new records to the userIndexedDB.

Parameters:
NameTypeDescription
paramsObject
Properties
NameTypeDescription
params.storestring

Identifier for the object store in the userIndexedDB.

params.objobject

Object to be stored in the userIndexedDB store.

Returns:

addPromise

Type: 
Promise

(inner) get(params) → {Promise}

The get method will retrieve records from the userIndexedDB.

Parameters:
NameTypeDescription
paramsObject

10941 user

Properties
NameTypeDescription
params.storestring

Identifier for the object store in the userIndexedDB.

params.nameobject

The key of the record to retrieve.

Returns:

getPromise

Type: 
Promise

(inner) list(params) → {Promise}

The list method will retrieve all records from the userIndexedDB store.

Parameters:
NameTypeDescription
paramsObject
Properties
NameTypeDescription
params.storestring

Identifier for the object store in the userIndexedDB.

Returns:

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].

Parameters:
NameTypeAttributesDefaultDescription
paramsobject
versioninteger<optional>
3

The version number for the userIndexedDB. Incremented when a new store needs to be created.

Properties
NameTypeAttributesDefaultDescription
params.storestring

The name of the object store to interact with.

params.indexedDBstring<optional>
"MAPP"

The name of the userIndexedDB database to open.

Returns:

OpenDBPromise

Type: 
Promise

(inner) put(params) → {Promise}

The put method will update existing records or add new records to the userIndexedDB.

Parameters:
NameTypeDescription
paramsObject
Properties
NameTypeDescription
params.namestring

The key of the record to update or add.

params.storestring

The name of the object store in the userIndexedDB.

params.objobject

The object to be stored in the userIndexedDB store.

Returns:

updatePromise

Type: 
Promise

(inner) remove(params) → {Promise}

The remove method will delete records from the userIndexedDB.

Parameters:
NameTypeDescription
paramsObject
Properties
NameTypeDescription
params.namestring

The key of the record to remove.

params.storestring

The name of the object store in the userIndexedDB.

Returns:

removePromise

Type: 
Promise