nsIDOMOfflineResourceList 编辑

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.

dom/interfaces/offline/nsIDOMOfflineResourceList.idlScriptable Please add a summary to this article.   Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)

Inherits from: nsISupports

Method overview

void mozAdd(in DOMString uri);
booleanmozHasItem(in DOMString uri);
DOMString mozItem(in unsigned long index);
void mozRemove(in DOMString uri);
void swapCache();
void update();

Attributes

AttributeTypeDescription
mozItemsnsIDOMOfflineResourceListThe list of dynamically-managed entries in the offline resource list. Read only.
mozLengthunsigned longThe number of entries in the dynamically managed offline resource list. Read only.
oncheckingnsIDOMEventListenerAn event listener to be called when fetching the application cache manifest and checking for updates.
onerrornsIDOMEventListenerAn event listener to be called when an error occurs during the caching process.
onnoupdatensIDOMEventListenerAn event listener to be called when there is no update to download.
ondownloadingnsIDOMEventListenerAn event listener to be called when resources are being downloaded into the cache.
onprogressnsIDOMEventListenerAn event listener to be called periodically throughout the download process.
onupdatereadynsIDOMEventListenerAn 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.
oncachednsIDOMEventListenerAn event listener to be called when caching is complete.
statusunsigned shortOne of the Application cache state constants indicating the status of the application cache.

Constants

Application cache state constants

ConstantValueDescription
UNCACHED0The object isn't associated with an application cache.
IDLE1The application cache is not in the process of being updated.
CHECKING2The application cache manifest is being fetched and checked for updates.
DOWNLOADING3Resources are being downloaded to be added to the cache.
UPDATEREADY4There is a new version of the application cache available.
OBSOLETE5The 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.

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.

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. The newest version of resources are updated on first refresh. This means already loaded resources should only update after a page refresh.

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. This will check for a new cache manifest but will not tell the browser to use the updated cache.

 void update();
Parameters

None.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:59 次

字数:10423

最后编辑:8 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文