ClearDataOptions
Narrows what session.clearData() removes.
A property left out widens the removal rather than narrowing it, so an empty object — or no options at all — removes every kind of data, for every site, of every age.
An empty list is not the same as leaving the property out: it narrows the
removal to nothing. session.clearData({ dataTypes: [] }) and
session.clearData({ origins: [] }) both remove nothing and resolve, which
is what lets a list computed from an empty selection be passed straight in.
Example
import { session } from '@mobrowser/api';
await session.clearData({
dataTypes: ['cookies'],
excludeOrigins: ['https://example.com']
})
Properties
dataTypes
dataTypes?: BrowsingDataType[];
The kinds of data to remove. Every kind is removed when omitted, and none when empty.
origins
origins?: string[];
Removes data of these sites only, and of no site when empty.
Each entry is a URL, but browsing data is scoped to a site rather than to
one origin, so the removal applies to the whole registrable domain: an
entry of https://mail.example.com removes the data of example.com and
every host under it. A URL naming an IP address or a name with no
registrable domain, such as http://localhost:3000, applies to that host
alone.
Cannot be combined with excludeOrigins.
excludeOrigins
excludeOrigins?: string[];
Removes the data of every site except these. An empty list excludes no site, so the removal covers every site.
Entries are matched the same way as in origins.
Cannot be combined with origins.
since
since?: number;
Removes only data recorded at or after this time, in seconds since the UNIX epoch.
Data of every age is removed when omitted.