You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** An object encapsulating one visit to a URL. */
5816
5816
export interface VisitItem {
5817
5817
/** The transition type for this visit from its referrer. */
5818
-
transition: string;
5819
-
/** Optional. When this visit occurred, represented in milliseconds since the epoch. */
5820
-
visitTime?: number | undefined;
5818
+
transition: `${TransitionType}`;
5819
+
/**
5820
+
* True if the visit originated on this device. False if it was synced from a different device
5821
+
* @since Chrome 115
5822
+
*/
5823
+
isLocal: boolean;
5824
+
/** When this visit occurred, represented in milliseconds since the epoch. */
5825
+
visitTime?: number;
5821
5826
/** The unique identifier for this visit. */
5822
5827
visitId: string;
5823
5828
/** The visit ID of the referrer. */
5824
5829
referringVisitId: string;
5825
-
/** The unique identifier for the item. */
5830
+
/** The unique identifier for the corresponding {@link history.HistoryItem}. */
5826
5831
id: string;
5827
5832
}
5828
5833
5829
5834
/** An object encapsulating one result of a history query. */
5830
5835
export interface HistoryItem {
5831
-
/** Optional. The number of times the user has navigated to this page by typing in the address. */
5832
-
typedCount?: number | undefined;
5833
-
/** Optional. The title of the page when it was last loaded. */
5834
-
title?: string | undefined;
5835
-
/** Optional. The URL navigated to by a user. */
5836
-
url?: string | undefined;
5837
-
/** Optional. When this page was last loaded, represented in milliseconds since the epoch. */
5838
-
lastVisitTime?: number | undefined;
5839
-
/** Optional. The number of times the user has navigated to this page. */
5840
-
visitCount?: number | undefined;
5836
+
/** The number of times the user has navigated to this page by typing in the address. */
5837
+
typedCount?: number;
5838
+
/** The title of the page when it was last loaded. */
5839
+
title?: string;
5840
+
/** The URL navigated to by a user. */
5841
+
url?: string;
5842
+
/** When this page was last loaded, represented in milliseconds since the epoch. */
5843
+
lastVisitTime?: number;
5844
+
/** The number of times the user has navigated to this page. */
5845
+
visitCount?: number;
5841
5846
/** The unique identifier for the item. */
5842
5847
id: string;
5843
5848
}
5844
5849
5850
+
/**
5851
+
* The transition type for this visit from its referrer.
5852
+
* @since Chrome 44
5853
+
*/
5854
+
export enum TransitionType {
5855
+
/** The user arrived at this page by clicking a link on another page. */
5856
+
LINK = "link",
5857
+
/** The user arrived at this page by typing the URL in the address bar. This is also used for other explicit navigation actions. */
5858
+
TYPED = "typed",
5859
+
/** The user arrived at this page through a suggestion in the UI, for example, through a menu item. */
5860
+
AUTO_BOOKMARK = "auto_bookmark",
5861
+
/** The user arrived at this page through subframe navigation that they didn't request, such as through an ad loading in a frame on the previous page. These don't always generate new navigation entries in the back and forward menus. */
5862
+
AUTO_SUBFRAME = "auto_subframe",
5863
+
/** The user arrived at this page by selecting something in a subframe. */
5864
+
MANUAL_SUBFRAME = "manual_subframe",
5865
+
/** The user arrived at this page by typing in the address bar and selecting an entry that didn't look like a URL, such as a Google Search suggestion. For example, a match might have the URL of a Google Search result page, but it might appear to the user as "Search Google for ...". These are different from typed navigations because the user didn't type or see the destination URL. They're also related to keyword navigations. */
5866
+
GENERATED = "generated",
5867
+
/** The page was specified in the command line or is the start page. */
5868
+
AUTO_TOPLEVEL = "auto_toplevel",
5869
+
/** The user arrived at this page by filling out values in a form and submitting the form. Not all form submissions use this transition type. */
5870
+
FORM_SUBMIT = "form_submit",
5871
+
/** The user reloaded the page, either by clicking the reload button or by pressing Enter in the address bar. Session restore and Reopen closed tab also use this transition type. */
5872
+
RELOAD = "reload",
5873
+
/** The URL for this page was generated from a replaceable keyword other than the default search provider. */
5874
+
KEYWORD = "keyword",
5875
+
/** Corresponds to a visit generated for a keyword. */
5876
+
KEYWORD_GENERATED = "keyword_generated",
5877
+
}
5878
+
5845
5879
export interface HistoryQuery {
5846
-
/** A free-text query to the history service. Leave empty to retrieve all pages. */
5880
+
/** A free-text query to the history service. Leave this empty to retrieve all pages. */
5847
5881
text: string;
5848
-
/** Optional. The maximum number of results to retrieve. Defaults to 100. */
5882
+
/** The maximum number of results to retrieve. Defaults to 100. */
5849
5883
maxResults?: number | undefined;
5850
-
/** Optional. Limit results to those visited after this date, represented in milliseconds since the epoch. */
5884
+
/** Limit results to those visited after this date, represented in milliseconds since the epoch. If property is not specified, it will default to 24 hours. */
5851
5885
startTime?: number | undefined;
5852
-
/** Optional. Limit results to those visited before this date, represented in milliseconds since the epoch. */
5886
+
/** Limit results to those visited before this date, represented in milliseconds since the epoch. */
5853
5887
endTime?: number | undefined;
5854
5888
}
5855
5889
5856
-
export interface Url {
5857
-
/** The URL for the operation. It must be in the format as returned from a call to history.search. */
5890
+
/** @since Chrome 88 */
5891
+
export interface UrlDetails {
5892
+
/** The URL for the operation. It must be in the format as returned from a call to {@link history.search}. */
* Searches the history for the last visit time of each page matching the query.
5881
-
* @return The `search` method provides its result via callback or returned as a `Promise` (MV3 only).
5911
+
*
5912
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
5882
5913
*/
5883
5914
export function search(query: HistoryQuery): Promise<HistoryItem[]>;
5884
-
/**
5885
-
* Searches the history for the last visit time of each page matching the query.
5886
-
*/
5887
5915
export function search(query: HistoryQuery, callback: (results: HistoryItem[]) => void): void;
5916
+
5888
5917
/**
5889
5918
* Adds a URL to the history at the current time with a transition type of "link".
5890
-
* @return The `addUrl` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5891
-
*/
5892
-
export function addUrl(details: Url): Promise<void>;
5893
-
/**
5894
-
* Adds a URL to the history at the current time with a transition type of "link".
5919
+
*
5920
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
5895
5921
*/
5896
-
export function addUrl(details: Url, callback: () => void): void;
5922
+
export function addUrl(details: UrlDetails): Promise<void>;
5923
+
export function addUrl(details: UrlDetails, callback: () => void): void;
5924
+
5897
5925
/**
5898
5926
* Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.
5899
-
* @return The `deleteRange` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5927
+
*
5928
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
5900
5929
*/
5901
5930
export function deleteRange(range: Range): Promise<void>;
5902
-
/**
5903
-
* Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.
5904
-
*/
5905
5931
export function deleteRange(range: Range, callback: () => void): void;
5932
+
5906
5933
/**
5907
5934
* Deletes all items from the history.
5908
-
* @return The `deleteAll` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5935
+
*
5936
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
5909
5937
*/
5910
5938
export function deleteAll(): Promise<void>;
5911
-
/**
5912
-
* Deletes all items from the history.
5913
-
*/
5914
5939
export function deleteAll(callback: () => void): void;
5940
+
5915
5941
/**
5916
5942
* Retrieves information about visits to a URL.
5917
-
* @return The `getVisits` method provides its result via callback or returned as a `Promise` (MV3 only).
5918
-
*/
5919
-
export function getVisits(details: Url): Promise<VisitItem[]>;
5920
-
/**
5921
-
* Retrieves information about visits to a URL.
5922
-
*/
5923
-
export function getVisits(details: Url, callback: (results: VisitItem[]) => void): void;
5924
-
/**
5925
-
* Removes all occurrences of the given URL from the history.
5926
-
* @return The `deleteUrl` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
5943
+
*
5944
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
5927
5945
*/
5928
-
export function deleteUrl(details: Url): Promise<void>;
5946
+
export function getVisits(details: UrlDetails): Promise<VisitItem[]>;
5947
+
export function getVisits(details: UrlDetails, callback: (results: VisitItem[]) => void): void;
5948
+
5929
5949
/**
5930
5950
* Removes all occurrences of the given URL from the history.
5951
+
*
5952
+
* Can return its result via Promise in Manifest V3 or later since Chrome 96.
5931
5953
*/
5932
-
export function deleteUrl(details: Url, callback: () => void): void;
5954
+
export function deleteUrl(details: UrlDetails): Promise<void>;
5955
+
export function deleteUrl(details: UrlDetails, callback: () => void): void;
5956
+
5957
+
/** Fired when a URL is visited, providing the {@link HistoryItem} data for that URL. This event fires before the page has loaded. */
0 commit comments