Visit Mozilla.org

nsIDOMOfflineResourceList

From MDC

This article covers features introduced in Firefox 3

The nsIDOMOfflineResourceList interface provides access to the application cache that allows web content's resources to be cached locally for use while offline. It includes methods for adding resources to and removing resources from the cache, as well as for enumerating the dynamically managed resource list.

Contents

nsIDOMOfflineResourceList is defined in dom/public/idl/offline/nsIDOMOfflineResourceList.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsISupports

[edit] Method overview

void add(in DOMString uri);
DOMString item(in unsigned long index);
void remove(in DOMString uri);
void swapCache();
void update();

[edit] Attributes

Attribute Type Description
length unsigned long The number of entries in the dynamically managed offline resource list. Read only.
onchecking nsIDOMEventListener An event listener to be called when fetching the application cache manifest and checking for updates.
onerror nsIDOMEventListener An event listener to be called when an error occurs during the caching process.
onnoupdate nsIDOMEventListener An event listener to be called when there is no update to download.
ondownloading nsIDOMEventListener An event listener to be called when resources are being downloaded into the cache.
onprogress nsIDOMEventListener An event listener to be called periodically throughout the download process.
onupdateready nsIDOMEventListener An event listener to be called when a resource update is ready; this event is not currently used since versioned application caches aren't supported yet.
oncached nsIDOMEventListener An event listener to be called when caching is complete.
status unsigned short One of the constants indicating the status of the application cache.

[edit] Constants

Constant Value Description
UNCACHED 0 The object isn't associated with an application cache.
IDLE 1 The application cache is not in the process of being updated.
CHECKING 2 The application cache manifest is being fetched and checked for updates.
DOWNLOADING 3 Resources are being downloaded to be added to the cache.
UPDATEREADY 4 There is a new version of the application cache available.
Note: Versioned application caches are not yet implemented, so this status value is not currently used.

[edit] Methods

[edit] add()

Adds an item to the dynamically managed entries. The resource will be fetched and added to the application cache.

 void add(
   in DOMString uri
 );
[edit] Parameters
uri
The URI of the resource to add to the list.

[edit] item()

Returns the URI of the item at the specific offset into the list of cached resources.

 DOMString item(
   in unsigned long index
 );
[edit] Parameters
index
The index of the cached item whose URI should be returned.
[edit] Return value

An DOMString containing the URI of the specified resource.

[edit] remove()

Removes an item from the list of dynamically managed entries. If this was the last reference to the given URI in the application cache, the cache entry is removed.

 void remove(
   in DOMString uri
 );
[edit] Parameters
uri
The URI of the item to remove from the list.

[edit] swapCache()

Swaps in the newest version of the application cache.

Note: Versioned application caches are not yet supported; this method will throw an exception.
 void swapCache();
[edit] Parameters

None.

[edit] update()

Begins the application cache update process.

 void update();
[edit] Parameters

None.

[edit] See also