Public Member Functions | Public Attributes

nsIDOMStorage Interface Reference

Interface for client side storage. More...

import "nsIDOMStorage.idl";

List of all members.

Public Member Functions

DOMString key (in unsigned long index)
 Retrieve the name of the key at a particular index.
DOMString getItem (in DOMString key)
 Retrieve an item with a given key.
void setItem (in DOMString key, in DOMString data)
 Assign a value with a key.
void removeItem (in DOMString key)
 Remove a key and its corresponding value.
void clear ()
 Clear the content of this storage bound to a domain or an origin.

Public Attributes

readonly attribute unsigned long length
 The number of keys stored.

Detailed Description

Interface for client side storage.

See http://www.whatwg.org/specs/web-apps/current-work/multipage/structured.html#storage0 for more information.

A storage object stores an arbitrary set of key-value pairs, which may be retrieved, modified and removed as needed. A key may only exist once within a storage object, and only one value may be associated with a particular key. Keys are stored in a particular order with the condition that this order not change by merely changing the value associated with a key, but the order may change when a key is added or removed.


Member Function Documentation

void nsIDOMStorage::clear (  ) 

Clear the content of this storage bound to a domain or an origin.

DOMString nsIDOMStorage::getItem ( in DOMString  key  ) 

Retrieve an item with a given key.

Parameters:
key key to retrieve
Returns:
found data or empty string if the key was not found
DOMString nsIDOMStorage::key ( in unsigned long  index  ) 

Retrieve the name of the key at a particular index.

Parameters:
index index of the item to retrieve
Returns:
the key at index
Exceptions:
INDEX_SIZE_ERR if there is no key at that index
void nsIDOMStorage::removeItem ( in DOMString  key  ) 

Remove a key and its corresponding value.

Parameters:
key key to remove
void nsIDOMStorage::setItem ( in DOMString  key,
in DOMString  data 
)

Assign a value with a key.

If the key does not exist already, a new key is added associated with that value. If the key already exists, then the existing value is replaced with a new value.

Parameters:
key key to set
data data to associate with the key

Member Data Documentation

readonly attribute unsigned long nsIDOMStorage::length

The number of keys stored.


The documentation for this interface was generated from the following file: