connect.history
Read, search, and prune the profile's browsing history.
Read and prune the profile's browsing history. Reading needs history.read; deleting
needs history.write. Like all data namespaces, it only ever touches the extension's own
profile.
- Capabilities:
history.read(list/search),history.write(delete) - Namespace:
connect.history
Walkthrough
Show recent history with search.
- Declare
history.read(andhistory.writeif you'll delete):{ "capabilities": ["history.read"] } - Feature-detect before reading — the user may not have granted it:
if (await connect.capabilities.contains('history.read')) render(await connect.history.list({ limit: 50 })); - Search on demand with
search(query). - Prune entries with
delete(id)(needshistory.write).
Methods
history.list(options?)
List history entries, newest first.
How to use it
- Pass
{ limit }for a page size (andoffsetto page). awaitthe array of entries.
Signature — connect.history.list({ limit?, offset? }) · Capability: history.read
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | no | Page size. |
offset | number | no | Skip this many (for paging). |
Returns — Promise<HistoryEntry[]>.
Errors — rejects with code: 'CAPABILITY_DENIED' without history.read.
const recent = await connect.history.list({ limit: 50 });history.search(query, limit?)
Search history by text.
How to use it
- Pass a
querystring (matched against title / URL) and an optionallimit. awaitthe matches.
Signature — connect.history.search(query, limit?) · Capability: history.read
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | Match against title / URL. |
limit | number | no | Max results. |
Returns — Promise<HistoryEntry[]>.
const hits = await connect.history.search('example.com', 20);history.delete(id)
Delete one history entry.
How to use it
- Pass the entry's
id(from alist/searchresult). - Requires
history.write.
Signature — connect.history.delete(id) · Capability: history.write
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | number | yes | The entry's id. |
Returns — Promise<void>.
Notes
- Feature-detect before reading:
if (await connect.capabilities.contains('history.read'))— the user may grantwritebut notread, or neither.