mozIAsyncHistory 编辑

toolkit/components/places/mozIAsyncHistory.idlScriptable This interface allows you to add multiple visits to a single URL in a batch. 1.0 66 Introduced Gecko 24.0 Inherits from: nsISupports Last changed in Gecko 24.0 (Firefox 24.0 / Thunderbird 24.0 / SeaMonkey 2.21)

Implemented by: @mozilla.org/browser/history;1 as a service:

var asyncHistory = Components.classes["@mozilla.org/browser/history;1"]
                   .getService(Components.interfaces.mozIAsyncHistory);

Method overview

void getPlacesInfo(in jsval aPlaceIdentifiers, in mozIVisitInfoCallback aCallback);
void isURIVisited(in nsIURI aURI, in mozIVisitedStatusCallback aCallback);
void updatePlaces(in mozIPlaceInfo, [optional] in mozIVisitInfoCallback aCallback);

Methods

getPlacesInfo()

Starts an asynchronous request to determine whether or not a given URI has been visited; you must implement a callback to receive the result of the request.

void getPlacesInfo(
  in jsval aPlaceIdentifiers,
  in mozIVisitInfoCallback aCallback
);
Parameters
aPlaceIdentifiers
The URI for which to determine the visited status.
aCallback
An object implementing the mozIVisitedStatusCallback.isVisited() method. If there's no information available for a given place, aCallback is called with a stub place info object, containing just the provided data (GUID or URI).

isURIVisited()

Starts an asynchronous request to determine whether or not a given URI has been visited; you must implement a callback to receive the result of the request.

void isURIVisited(
  in nsIURI aURI,
  in mozIVisitedStatusCallback aCallback
);
Parameters
aURI
The places for which to retrieve information, identified by either a single place GUID, a single URI, or a JS array of URIs and/or GUIDs.
aCallback
An object implementing the mozIVisitedStatusCallback.isVisited() method; this method will be called with the results once the request has been completed.

updatePlaces()

Adds a set of visits for one or more mozIPlaceInfo objects, and updates each mozIPlaceInfo's title or GUID.  Note that this lets you add to history even in Private Browsing mode; if that's not desired you can first check whether the window is in Private Browsing mode.

void updatePlaces(
  in mozIPlaceInfo aPlaceInfo,
  in mozIVisitInfoCallback aCallback Optional
);
Parameters
aPlaceInfo
The mozIPlaceInfo object[s] containing the information to store or update. This can be a single object, or an array of objects.
aCallback Optional
A mozIVisitInfoCallback object to be notified for each visit addition, title change, GUID change, or error. If more than one operation is performed for a given visit, only one callback will be given (i.e. title change and add visit).
Exceptions thrown
NS_ERROR_INVALID_ARG

See also

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

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

发布评论

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

词条统计

浏览:96 次

字数:6952

最后编辑:7 年前

编辑次数:0 次

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