Places:History API: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Moved content to developer.mozilla.org)
 
Line 1: Line 1:
== How to use the "Places" History API (nsNavHistory/nsNavBookmarks) ==
Information on using the places history API can be found on the [http://developer.mozilla.org/en/docs/Places:Query_System Mozilla developer site]. Also see the definitions of the API in [http://lxr.mozilla.org/seamonkey/source/browser/components/places/public/nsINavHistoryService.idl browser/components/places/public/nsINavHistoryService.idl]
 
Most information from the [[Browser_History]] and bookmarks system comes from executing queries on the history system (nsINavHistory.executeQuery/executeQueries). This will give you a nsINavHistoryResult object which will contain a tree structure of the results. The definitions of these structures is in [http://lxr.mozilla.org/seamonkey/source/browser/components/places/public/nsINavHistoryService.idl browser/components/places/public/nsINavHistoryService.idl]
 
== Executing a query ==
 
There are two parts of a query: a list of one or more nsINavHistoryQuery objects, and an nsINavHistoryQueryOptions object. You first need to fill out these structures with the parameters you want. Use nsINavHistoryService.getNewQuery and nsINavHistoryService.getNewQueryOptions to retrieve empty objects. These objects typically have empty values for each possible field, so using them in their initial state will give you all of history in a flat list.
 
 
=== Bookmark queries ===
 
== Using the results ==
 
Write me.
 
Note: Be careful when accessing nodes and do not keep references to them around. Notifications sent to the result from the history and bookmarks system, as well as commands executed by the programmer such as sorting may cause the structure to change and nodes may be inserted, removed, or replaced.

Latest revision as of 18:02, 20 March 2006

Information on using the places history API can be found on the Mozilla developer site. Also see the definitions of the API in browser/components/places/public/nsINavHistoryService.idl