nsILivemarkService 编辑

toolkit/components/places/public/nsILivemarkService.idlScriptable This interface is used to create and reload livemarks. You can also use this check whether something is a livemark or not. 1.0 66 Introduced Gecko 1.8 Obsolete Gecko 22.0 Inherits from: nsISupports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) This interface is obsolete.

Implemented by: @mozilla.org/browser/livemark-service;2. To use this service, use:

var livemarkService = Components.classes["@mozilla.org/browser/livemark-service;2"]
                      .getService(Components.interfaces.nsILivemarkService);

Method overview

long long createLivemark(in long long folder, in AString name, in nsIURI siteURI, in nsIURI feedURI, in long index);
long long createLivemarkFolderOnly(in long long folder, in AString name, in nsIURI siteURI, in nsIURI feedURI, in long index);
nsIURI getFeedURI(in long long container);
long long getLivemarkIdForFeedURI(in nsIURI aFeedURI);
nsIURI getSiteURI(in long long container);
boolean isLivemark(in long long folder);
void reloadAllLivemarks();
void reloadLivemarkFolder(in long long folderID);
void setFeedURI(in long long container, in nsIURI feedURI);
void setSiteURI(in long long container, in nsIURI siteURI);
void start();
void stopUpdateLivemarks();

Methods

createLivemark()

Creates a new livemark.

long long createLivemark(
  in long long folder,
  in AString name,
  in nsIURI siteURI,
  in nsIURI feedURI,
  in long index
);
Parameters
folder
The id of the parent folder.
name
The name to show when displaying the livemark.
siteURI
The URI of the site from which the livemark was created.
feedURI
The URI of the actual RSS feed.
index
The index to insert at, or -1 to append to the end of the list.
Return value

The ID of the folder for the livemark.

createLivemarkFolderOnly()

This method also creates a new livemark but use this method during startup to avoid HTTP traffic.

long long createLivemarkFolderOnly(
  in long long folder,
  in AString name,
  in nsIURI siteURI,
  in nsIURI feedURI,
  in long index
);
Parameters
folder
The id of the parent folder.
name
The name to show when displaying the livemark.
siteURI
The URI of the site from which the livemark was created.
feedURI
The URI of the actual RSS feed.
index
The index to insert at, or -1 to append to the end of the list.
Return value

Returns the ID of the folder for the livemark.

getFeedURI()

This method retrieves the URI of the syndication feed associated with a livemark container.

nsIURI getFeedURI(
  in long long container
);
Parameters
container
The folder ID of a livemark container.
Return value

A nsIURI representing the URI of the feed; if the livemark container doesn't have a valid feed URI, null will be returned or the nsIURI object returned will be the empty string.

Exceptions thrown
NS_ERROR_INVALID_ARG
If the folder ID isn't known or identifies a folder that isn't a livemark container.
NS_ERROR_MALFORMED_URI
If the site URI annotation has somehow been corrupted (and can't be turned into an nsIURI)

getLivemarkIdForFeedURI()

Determines whether the feed URI is a currently registered livemark.

long long getLivemarkIdForFeedURI(
  in nsIURI aFeedURI
);
Parameters
aFeedURI
Feed URI to look for.
Return value

The ID of the livemark.

getSiteURI()

This method retrieves the URI of the website associated with a livemark container.

nsIURI getSiteURI(
  in long long container
);
Parameters
container
The folder ID of a livemark container.
Return value

A nsIURI representing the URI of the website; if the livemark container doesn't have a valid site URI, null will be returned.

Exceptions thrown
NS_ERROR_INVALID_ARG
If the folder ID isn't known or identifies a folder that isn't a livemark container.
NS_ERROR_MALFORMED_URI
If the site URI annotation has somehow been corrupted (and can't be turned into an nsIURI)

isLivemark()

This method determines whether the folder with the given folder ID identifies a livemark container.

boolean isLivemark(
  in long long folder
);
Parameters
folder
A folder ID.
Return value

true if the given folder is a livemark folder, otherwise it returns false.

Exceptions thrown
NS_ERROR_INVALID_ARG
If the folder ID isn't known.

reloadAllLivemarks()

This method reloads all livemark subscriptions, whether or not they have expired.

void reloadAllLivemarks();
Parameters

None.

reloadLivemarkFolder()

This method reloads the livemark with this folder ID, whether or not it's expired.

void reloadLivemarkFolder(
  in long long folderID
);
Parameters
folderID
The ID of the folder to be reloaded.

setFeedURI()

This method sets the URI of the feed associated with a livemark container.

Note: The caller is responsible for reloading the livemark after changing its feed URI (since the contents are likely to be different given a different feed).
void setFeedURI(
  in long long container,
  in nsIURI feedURI
);
Parameters
container
The folder ID of a livemark container.
feedURI
nsIURI object representing the syndication feed URI.
Exceptions thrown
NS_ERROR_INVALID_ARG
If the folder ID isn't known or identifies a folder that isn't a livemark container; also if the feedURI parameter isn't a valid nsIURI object.

setSiteURI()

This method sets the URI of the website associated with a livemark container.

void setSiteURI(
  in long long container,
  in nsIURI siteURI
);
Parameters
container
The folder ID of a livemark container.
siteURI
nsIURI object representing the site URI, or null to clear the site URI for this livemark container.
Exceptions thrown
NS_ERROR_INVALID_ARG
If the folder ID isn't known or identifies a folder that isn't a livemark container; also if the siteURI argument isn't a valid nsIURI object (or null)

start()

This method starts the livemark refresh timer. Being able to manually control this allows activity such as bookmarks import to occur without kicking off HTTP traffic.

void start();
Parameters

None.

stopUpdateLivemarks()

Stop the livemark refresh timer.

void stopUpdateLivemarks();
Parameters

None.

See also

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

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

发布评论

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

词条统计

浏览:55 次

字数:12971

最后编辑:6 年前

编辑次数:0 次

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