Manage Exceptions
Provides control over which URLs are given an exception from being blocked.
Get the Exceptions List
import { FilterException } from '@sudoplatform/sudo-ad-tracker-blocker'
const exceptions: FilterException[] = await client.getExceptions()let client: SudoAdTrackerBlockerClient!
let exceptions = await client.getExceptions()// val client: SudoAdTrackerBlockerClient
launch {
try {
val isMySiteExcepted = withContext(Dispatchers.IO) {
client.getExceptions().firstOrNull { exc ->
exc.source.contains("http://myfavourite.domain.eu")
}
} ?: false
} catch (e: SudoAdTrackerBlockerException) {
// Handle/notify user of exception
}
}Add to the Exceptions List
import { FilterException } from '@sudoplatform/sudo-ad-tracker-blocker'
const hostException: FilterException = {
// `type` === 'host' prevents blocking on
// any pages at `example.com`.
type: 'host',
source: 'http://example.com/page.html'
}
const pageException: FilterException = {
// `type` === 'page' prevents blocking on
// only `example.com/page.html`.
type: 'page',
source: 'https://example.com/page.html'
}
// Add both exceptions to the exceptions list
await client.addExceptions([
hostException,
pageException
])Remove from the Exceptions List
Removing all the Entries from the Exceptions List
Last updated