Storage ‹ Chocolat API

Storage.persistent()

Returns the persistent global storage object. Data is saved between launches.

Returns Object – A storage object.

Storage.transient()

Returns the transient global storage object. Data is deleted when the app is quit.

Returns Object – A storage object.

.get(k)

Retrieves a value in the storage.

  • k String – the key to retrieve.

Returns Object – the value for the given key.

.set(k, v)

Sets a value in the storage.

  • k String – the key to set.
  • v Object – the value to set it to (can be anything).

.count()

Returns the number of keys in the storage.
s

Returns Number – number of keys in storage.

.each(f)

Applies function f to every items in the storage. The function should
have the following signature: f(k, v) where k is the key for the item
and v is its value.

  • f Function – the function to apply to each items `f(k,v)`.