/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

(inner) get(locale) → {Object}

The get method requests a locale stored in a userIndexedDB.

Parameters:
NameTypeDescription
localeObject
Properties
NameTypeDescription
locale.userLocaleObject

The userLocale config.

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

(inner) list(workspace)

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

Parameters:
NameTypeDescription
workspacestring

The workspace identifier.

(inner) put(params)

The put method stores the params object in the userIndexedDB.

Parameters:
NameTypeDescription
paramsObject
Properties
NameTypeDescription
params.storestring

The store identifier.

params.workspacestring

The workspace identifier.

params.namestring

The custom name under which the object is stored.

params.objectObject

The object to be stored in the userIndexedDB.

(inner) putLocale(mapview) → {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: 
Object

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