The goog.storage.mechanism.HTML5WebStorage Class

goog.storage.mechanism.HTML5WebStorage
> goog.storage.mechanism.IterableMechanism
> goog.storage.mechanism.Mechanism

goog.storage.mechanism.HTML5WebStorage(storage)

Provides a storage mechanism that uses HTML5 Web storage.

storage {?Storage}
The Web storage object.

.__iterator__(opt_keys)

Returns an iterator that iterates over the elements in the storage. Will throw goog.iter.StopIteration after the last element.

opt_keys {boolean=}
True to iterate over the keys. False to iterate over the values. The default value is false.
returns {!goog.iter.Iterator}
The iterator.

.clear()

Remove all key-value pairs. Could be overridden in a subclass, as the default implementation is not very efficient - it iterates over all keys.

.get()

.getCount()

Get the number of stored key-value pairs. Could be overridden in a subclass, as the default implementation is not very efficient - it iterates over all keys.

returns {number}
Number of stored elements.

.isAvailable()

Determines whether or not the mechanism is available. It works only if the provided web storage object exists and is enabled.

returns {boolean}
True if the mechanism is available.

.remove()

.set()