nsIDOMOfflineResourceList

  • Revision slug: nsIDOMOfflineResourceList
  • Revision title: nsIDOMOfflineResourceList
  • Revision id: 74471
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment

Revision Content

{{template.Fx_minversion_header(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.


{{template.InterfaceStatus("nsIDOMOfflineResourceList", "dom/public/idl/offline/nsIDOMOfflineResourceList.idl", "unfrozen", "Mozilla 1.9", "yes")}}

Inherits from: {{template.Interface("nsISupports")}}

Method overview

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

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.

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.

{{template.Note("Versioned application caches are not yet implemented, so this status value is not currently used.")}}

Methods

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
 );
Parameters
<tt>uri</tt>
The URI of the resource to add to the list.

item()

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

 DOMString item(
   in unsigned long index
 );
Parameters
<tt>index</tt>
The index of the cached item whose URI should be returned.
Return value

An DOMString containing the URI of the specified resource.

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
 );
Parameters
<tt>uri</tt>
The URI of the item to remove from the list.

swapCache()

Swaps in the newest version of the application cache.

{{template.Note("Versioned application caches are not yet supported; this method will throw an exception.")}}

 void swapCache();
Parameters

None.

update()

Begins the application cache update process.

 void update();
Parameters

None.

See also=

Revision Source

<p>
{{template.Fx_minversion_header(3)}}
The <code>nsIDOMOfflineResourceList</code> 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.
</p><p><br>
{{template.InterfaceStatus("nsIDOMOfflineResourceList", "dom/public/idl/offline/nsIDOMOfflineResourceList.idl", "unfrozen", "Mozilla 1.9", "yes")}}
</p><p>Inherits from: {{template.Interface("nsISupports")}}
</p>
<h2 name="Method_overview">Method overview</h2>
<table class="standard-table">

<tbody><tr>
<td> <code>void <a href="#add.28.29">add</a>(in <a href="en/DOMString">DOMString</a> uri);</code>
</td></tr>
<tr>
<td> <code><a href="en/DOMString">DOMString</a> <a href="#item.28.29">item</a>(in unsigned long index);</code>
</td></tr>
<tr>
<td> <code>void <a href="#remove.28.29">remove</a>(in <a href="en/DOMString">DOMString</a> uri);</code>
</td></tr>
<tr>
<td> <code>void <a href="#swapCache.28.29">swapCache</a>();</code>
</td></tr>
<tr>
<td> <code>void <a href="#update.28.29">update</a>();</code>
</td></tr>
</tbody></table>
<h2 name="Attributes">Attributes</h2>
<table class="standard-table">

<tbody><tr>
<td class="header">Attribute
</td><td class="header">Type
</td><td class="header">Description
</td></tr>

<tr>
<td><code>length</code>
</td><td><code>unsigned long</code>
</td><td> The number of entries in the dynamically managed offline resource list.  <i>Read only</i>.
</td></tr>
<tr>
<td><code>onchecking</code>
</td><td><code><a href="en/NsIDOMEventListener">nsIDOMEventListener</a></code>
</td><td> An event listener to be called when fetching the application cache manifest and checking for updates.
</td></tr>
<tr>
<td><code>onerror</code>
</td><td><code><a href="en/NsIDOMEventListener">nsIDOMEventListener</a></code>
</td><td> An event listener to be called when an error occurs during the caching process.
</td></tr>
<tr>
<td><code>onnoupdate</code>
</td><td><code><a href="en/NsIDOMEventListener">nsIDOMEventListener</a></code>
</td><td> An event listener to be called when there is no update to download.
</td></tr>
<tr>
<td><code>ondownloading</code>
</td><td><code><a href="en/NsIDOMEventListener">nsIDOMEventListener</a></code>
</td><td> An event listener to be called when resources are being downloaded into the cache.
</td></tr>
<tr>
<td><code>onprogress</code>
</td><td><code><a href="en/NsIDOMEventListener">nsIDOMEventListener</a></code>
</td><td> An event listener to be called periodically throughout the download process.
</td></tr>
<tr>
<td><code>onupdateready</code>
</td><td><code><a href="en/NsIDOMEventListener">nsIDOMEventListener</a></code>
</td><td> 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.
</td></tr>
<tr>
<td><code>oncached</code>
</td><td><code><a href="en/NsIDOMEventListener">nsIDOMEventListener</a></code>
</td><td> An event listener to be called when caching is complete.
</td></tr>
<tr>
<td><code>status</code>
</td><td><code>unsigned short</code>
</td><td> One of the <a href="#constants">constants</a> indicating the status of the application cache.
</td></tr>
</tbody></table>
<h2 name="Constants">Constants</h2>
<table class="standard-table">

<tbody><tr>
<td class="header">Constant
</td><td class="header">Value
</td><td class="header">Description
</td></tr>

<tr>
<td><code>UNCACHED</code>
</td><td> 0
</td><td>The object isn't associated with an application cache.
</td></tr>
<tr>
<td><code>IDLE</code>
</td><td> 1
</td><td>The application cache is not in the process of being updated.
</td></tr>
<tr>
<td><code>CHECKING</code>
</td><td>2
</td><td>The application cache manifest is being fetched and checked for updates.
</td></tr>
<tr>
<td><code>DOWNLOADING</code>
</td><td>3
</td><td>Resources are being downloaded to be added to the cache.
</td></tr>
<tr>
<td><code>UPDATEREADY</code>
</td><td>4
</td><td>There is a new version of the application cache available.
<p>{{template.Note("Versioned application caches are not yet implemented, so this status value is not currently used.")}}
</p>
</td></tr>
</tbody></table>
<h2 name="Methods">Methods</h2>
<h3 name="add.28.29">add()</h3>
<p>Adds an item to the dynamically managed entries.  The resource will be fetched and added to the application cache.
</p>
<pre class="eval"> void add(
   in DOMString uri
 );
</pre>
<h6 name="Parameters">Parameters</h6>
<dl><dt><tt>uri</tt>
</dt><dd>The URI of the resource to add to the list.
</dd></dl>
<h3 name="item.28.29">item()</h3>
<p>Returns the URI of the item at the specific offset into the list of cached resources.
</p>
<pre class="eval"> DOMString item(
   in unsigned long index
 );
</pre>
<h6 name="Parameters_2">Parameters</h6>
<dl><dt><tt>index</tt>
</dt><dd>The index of the cached item whose URI should be returned.
</dd></dl>
<h6 name="Return_value">Return value</h6>
<p>An <code><a href="en/DOMString">DOMString</a></code> containing the URI of the specified resource.
</p>
<h3 name="remove.28.29">remove()</h3>
<p>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.
</p>
<pre class="eval"> void remove(
   in DOMString uri
 );
</pre>
<h6 name="Parameters_3">Parameters</h6>
<dl><dt><tt>uri</tt>
</dt><dd> The URI of the item to remove from the list.
</dd></dl>
<h3 name="swapCache.28.29">swapCache()</h3>
<p>Swaps in the newest version of the application cache.
</p><p>{{template.Note("Versioned application caches are not yet supported; this method will throw an exception.")}}
</p>
<pre class="eval"> void swapCache();
</pre>
<h6 name="Parameters_4">Parameters</h6>
<p>None.
</p>
<h3 name="update.28.29">update()</h3>
<p>Begins the application cache update process.
</p>
<pre class="eval"> void update();
</pre>
<h6 name="Parameters_5">Parameters</h6>
<p>None.
</p>
<h2 name="See_also.3D">See also=</h2>
<ul><li> <a href="en/Offline_resources_in_Firefox">Offline resources in Firefox</a>
</li></ul>
Revert to this revision