nsIDOMOfflineResourceList

  • Revision slug: nsIDOMOfflineResourceList
  • Revision title: nsIDOMOfflineResourceList
  • Revision id: 74480
  • Created:
  • Creator: bradleymeck
  • Is current revision? No
  • Comment 32 words added

Revision Content

{{ gecko_minversion_header("1.9") }}

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.

{{ InterfaceStatus("nsIDOMOfflineResourceList", "dom/interfaces/offline/nsIDOMOfflineResourceList.idl", "unfrozen", "Mozilla 1.9.2", "yes") }}

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

Method overview

void mozAdd(in DOMString uri);  
boolean mozHasItem(in DOMString uri); {{ deprecated_inline() }}  
DOMString mozItem(in unsigned long index); {{ deprecated_inline() }}  
void mozRemove(in DOMString uri);  
void swapCache(); Instructs the browser to use the most up to date cache possible on the next page refresh.
void update(); Instructs the browser to check if an updated cache-manifest is available.

Attributes

Attribute Type Description
mozItems {{ interface("nsIDOMOfflineResourceList") }} The list of dynamically-managed entries in the offline resource list. Read only.
mozLength unsigned long The number of entries in the dynamically managed offline resource list. Read only. {{ deprecated_inline() }}
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 {{ anch("Application cache state constants") }} indicating the status of the application cache.

Constants

Application cache state 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.
OBSOLETE 5 The application cache group is now obsolete.

Methods

mozAdd()

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

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

{{ method_deprecated("mozHasItem") }}

Returns a Boolean value indicating whether or not the specified URI represents a resource that's in the application cache's list.

Note: This method has been deprecated. You should use the mozItems attribute instead.
 void mozHasItem(
   in DOMString uri
 );
Parameters
uri
The URI of the resource to check.
Return value

true if the resource is in the list, otherwise false.

{{ method_deprecated("mozItem") }}

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

Note: This method is deprecated in Firefox 3.5; you should instead access the list directly using the items attribute.
 DOMString mozItem(
   in unsigned long index
 );
Parameters
index
The index of the cached item whose URI should be returned.
Return value

An DOMString containing the URI of the specified resource.

mozRemove()

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 mozRemove(
   in DOMString uri
 );
Parameters
uri
The URI of the item to remove from the list.

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();
Parameters

None.

update()

Begins the application cache update process.

 void update();
Parameters

None.

See also

  • Offline resources in Firefox
  • {{ interface("nsIApplicationCache") }}
  • {{ interface("nsIApplicationCacheContainer") }}
  • {{ interface("nsIApplicationCacheService") }}
  • {{ interface("nsIApplicationCacheChannel") }}
  • {{ interface("nsIApplicationCacheNamespace") }}

{{ languages( { "ja": "ja/NsIDOMOfflineResourceList" } ) }}

Revision Source

<p>{{ gecko_minversion_header("1.9") }}</p>
<p>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>{{ InterfaceStatus("nsIDOMOfflineResourceList", "dom/interfaces/offline/nsIDOMOfflineResourceList.idl", "unfrozen", "Mozilla 1.9.2", "yes") }}</p>
<p>Inherits from: {{ Interface("nsISupports") }}</p>
<h2 name="Method_overview">Method overview</h2>
<table class="standard-table"> <tbody> <tr> <td><code>void <a href="#add.28.29">mozAdd</a>(in <a href="/en/DOMString" title="en/DOMString">DOMString</a> uri);</code></td> <td> </td> </tr> <tr> <td><span style="font-family: monospace;">boolean</span><code> <a class="internal" href="/en/nsIDOMOfflineResourceList#hasItem()" title="en/nsIDOMOfflineResourceList#hasItem()">mozHasItem</a>(in <a href="/en/DOMString" title="en/DOMString">DOMString</a> uri);</code><code> {{ deprecated_inline() }}</code></td> <td> </td> </tr> <tr> <td><code><a href="/en/DOMString" title="en/DOMString">DOMString</a> <a href="#item.28.29">mozItem</a>(in unsigned long index); {{ deprecated_inline() }}</code></td> <td> </td> </tr> <tr> <td><code>void <a href="#remove.28.29">mozRemove</a>(in <a href="/en/DOMString" title="en/DOMString">DOMString</a> uri);</code></td> <td> </td> </tr> <tr> <td><code>void <a href="#swapCache.28.29">swapCache</a>();</code></td> <td>Instructs the browser to use the most up to date cache possible on the next page refresh.</td> </tr> <tr> <td><code>void <a href="#update.28.29">update</a>();</code></td> <td>Instructs the browser to check if an updated cache-manifest is available.</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>mozItems</code></td> <td>{{ interface("nsIDOMOfflineResourceList") }}</td> <td>The list of dynamically-managed entries in the offline resource list. <em>Read only.</em></td> </tr> <tr> <td><code>mozLength</code></td> <td><code>unsigned long</code></td> <td>The number of entries in the dynamically managed offline resource list. <em>Read only</em>. {{ deprecated_inline() }}</td> </tr> <tr> <td><code>onchecking</code></td> <td><code><a href="/en/XPCOM_Interface_Reference/nsIDOMEventListener" title="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/XPCOM_Interface_Reference/nsIDOMEventListener" title="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/XPCOM_Interface_Reference/nsIDOMEventListener" title="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/XPCOM_Interface_Reference/nsIDOMEventListener" title="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/XPCOM_Interface_Reference/nsIDOMEventListener" title="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/XPCOM_Interface_Reference/nsIDOMEventListener" title="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/XPCOM_Interface_Reference/nsIDOMEventListener" title="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 {{ anch("Application cache state constants") }} indicating the status of the application cache.</td> </tr> </tbody>
</table>
<h2 name="Constants">Constants</h2>
<h3>Application cache state constants</h3>
<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.</td> </tr> <tr> <td><code>OBSOLETE</code></td> <td>5</td> <td>The application cache group is now obsolete.</td> </tr> </tbody>
</table>
<h2 name="Methods">Methods</h2>
<h3 name="add.28.29">mozAdd()</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 mozAdd(
   in DOMString uri
 );
</pre>
<h6 name="Parameters">Parameters</h6>
<dl> <dt><code>uri</code></dt> <dd>The URI of the resource to add to the list.</dd>
</dl>
<p>{{ method_deprecated("mozHasItem") }}</p>
<p>Returns a Boolean value indicating whether or not the specified URI represents a resource that's in the application cache's list.</p>
<div class="note"><strong>Note:</strong> This method has been deprecated. You should use the <code>mozItems</code> attribute instead.</div>
<pre class="eval"> void mozHasItem(
   in DOMString uri
 );
</pre>
<h6 name="Parameters">Parameters</h6>
<dl> <dt><code>uri</code></dt> <dd>The URI of the resource to check.</dd>
</dl>
<h6>Return value</h6>
<p><code>true</code> if the resource is in the list, otherwise <code>false</code>.</p>
<p>{{ method_deprecated("mozItem") }}</p>
<p>Returns the URI of the item at the specific offset into the list of cached resources.</p>
<div class="note"><strong>Note:</strong> This method is deprecated in Firefox 3.5; you should instead access the list directly using the <code>items</code> attribute.</div>
<pre class="eval"> DOMString mozItem(
   in unsigned long index
 );
</pre>
<h6 name="Parameters_2">Parameters</h6>
<dl> <dt><code>index</code></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" title="en/DOMString">DOMString</a></code> containing the URI of the specified resource.</p>
<h3 name="remove.28.29">mozRemove()</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 mozRemove(
   in DOMString uri
 );
</pre>
<h6 name="Parameters_3">Parameters</h6>
<dl> <dt><code>uri</code></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>{{ 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">See also</h2>
<ul> <li><a href="/en/Using_Application_Cache" title="en/Offline_resources_in_Firefox">Offline resources in Firefox</a></li> <li>{{ interface("nsIApplicationCache") }}</li> <li>{{ interface("nsIApplicationCacheContainer") }}</li> <li>{{ interface("nsIApplicationCacheService") }}</li> <li>{{ interface("nsIApplicationCacheChannel") }}</li> <li>{{ interface("nsIApplicationCacheNamespace") }}</li>
</ul>
<p>{{ languages( { "ja": "ja/NsIDOMOfflineResourceList" } ) }}</p>
Revert to this revision