Class YAHOO.util.Storage
The Storage class is an HTML 5 storage API clone, used to wrap individual storage implementations with a common API.
Constructor
YAHOO.util.Storage
(
location
,
conf
)
- Parameters:
-
location
<String>
Required. The storage location.
-
conf
<Object>
Required. A configuration object.
Properties
_cfg
- protected {Object}
The configuration of the engine.
_location
- protected {String}
The location for this instance.
_name
- protected {String}
The event name for when the storage item has changed.
The event name for when the storage item is ready.
The delimiter uesed between the data type and the data.
isReady
- protected {String}
This engine singleton has been initialized already.
The current length of the keys.
Methods
protected
void
_clear
(
)
Implementation of the clear login; should be overwritten by storage engine.
protected
void
_createValue
(
s
)
Converts the object into a string, with meta data (type), so it can be restored later.
- Parameters:
-
s
<Object>
Required. An object to store.
- Returns:
void
protected
String|NULL
_getItem
(
key
)
Implementation of the getItem login; should be overwritten by storage engine.
- Parameters:
-
key
<String>
Required. The key used to reference this value.
- Returns:
String|NULL
- The value stored at the provided key.
protected
void
_getValue
(
s
)
Converts the stored value into its appropriate type.
- Parameters:
-
s
<String>
Required. The stored value.
- Returns:
void
protected
String|NULL
_key
(
index
)
Implementation of the key logic; should be overwritten by storage engine.
- Parameters:
-
index
<Number>
Required. The index to retrieve (unsigned long in HTML 5 spec).
- Returns:
String|NULL
- Required. The key at the provided index (DOMString in HTML 5 spec).
protected
void
_removeItem
(
key
)
Implementation of the removeItem login; should be overwritten by storage engine.
- Parameters:
-
key
<String>
Required. The key to remove.
- Returns:
void
protected
Boolean
_setItem
(
key
,
data
)
Implementation of the setItem login; should be overwritten by storage engine.
- Parameters:
-
key
<String>
Required. The key used to reference this value.
-
data
<Object>
Required. The data to storage at key.
- Returns:
Boolean
- True when successful, false when size QUOTA exceeded.
void
clear
(
)
Clears any existing key/value pairs.
String|NULL
getItem
(
key
)
Fetches the data stored and the provided key.
- Parameters:
-
key
<String>
Required. The key used to reference this value (DOMString in HTML 5 spec).
- Returns:
String|NULL
- The value stored at the provided key (DOMString in HTML 5 spec).
String
getName
(
)
Fetches the storage object's name; should be overwritten by storage engine.
- Returns:
String
- The name of the data storage object.
Boolean
hasKey
(
key
)
Tests if the key has been set (not in HTML 5 spec); should be overwritten by storage engine.
- Parameters:
-
key
<String>
Required. The key to search for.
- Returns:
Boolean
- True when key has been set.
String
key
(
index
)
Retrieve the key stored at the provided index; should be overwritten by storage engine.
- Parameters:
-
index
<Number>
Required. The index to retrieve (unsigned long in HTML 5 spec).
- Returns:
String
- Required. The key at the provided index (DOMString in HTML 5 spec).
void
setItem
(
key
)
Remove an item from the data storage.
- Parameters:
-
key
<String>
Required. The key to remove (DOMString in HTML 5 spec).
- Returns:
void