/utils/userLocale

The userLocale utility module exports methods to get, put (create or overwrite), or delete a userLocale object in a userIndexedDB.

At current the module requires the userIndexedDB utility module to store the userLocale in an indexedDB.

Locales can be stored in the locales store.

The locales store is part of an [indexed] DB identified by the user and the workspace.

A workspace is unique to an XYZ instance.

A decorated locale object must be parsed with the jsonParser utility method in order to be stored as a JSON object in a store.

Requires

Methods

(async, inner) get(locale) → {Object}

The get method requests a locale stored in a userIndexedDB.

Parameters:
NameTypeDescription
localeObject
Properties
NameTypeDescription
locale.workspaceObject

Identifies the XYZ instance.

locale.nameObject

The custom name under which a locale is stored.

Returns:

Returns a locale object stored as a userLocale.

Type: 
Object

(async, inner) list(workspace)

Requests an array of locales [key, name] from the 'locales' database store.

Parameters:
NameTypeDescription
workspacestring

The workspace identifier.

(async, inner) putLocale(mapview) → {Promise.<Object>}

The putLocale method calls the put method to store a locale object in the userIndexedDB.

Parameters:
NameTypeDescription
mapviewObject

The mapview object.

Properties
NameTypeDescription
paramsstring

The params object.

Returns:

Returns the response object from the put method.

Type: 
Promise.<Object>

(async, inner) remove(locale)

The method removes a locale from the database 'locales' store.

Parameters:
NameTypeDescription
localeObject
Properties
NameTypeDescription
locale.workspaceObject

The workspace identifier.

locale.nameObject

The custom name under which a locale is stored.