Class: FilterEngine

(private) filterEngine~FilterEngine()

filterEngine implementation.

Constructor

(private) new FilterEngine()

Creates the filterEngine object.

Source:

Members

(private, nullable) _initializationPromise :Promise

Type:
  • Promise
Source:

Methods

(package) add(filter)

Adds a new filter.

Parameters:
Name Type Description
filter module:filterClasses.ActiveFilter
Source:

(package) clear()

Clears all filters.

Source:

(package) has(filter) → {boolean}

Checks whether a filter exists.

Parameters:
Name Type Description
filter module:filterClasses.ActiveFilter
Source:
Returns:
Type
boolean

initialize(filterSourceopt) → {Promise}

Initializes the filterEngine object with the given filters or filters loaded from disk.

Parameters:
Name Type Attributes Description
filterSource Iterable.<string> <optional>

An iterable object that yields the text of the filters with which to initialize the filterEngine object. If omitted, filters are loaded from disk.

Source:
Returns:

A promise that is fulfilled when the initialization is complete.

Type
Promise

match(url, typeMask, documentHostname, sitekeyopt, nullable, specificOnlyopt) → (nullable) {string}

Matches existing URL filters against a web resource (HTML document, CSS style sheet, PNG image, etc.) and returns the matching filter if there's a match.

Parameters:
Name Type Attributes Default Description
url string | URL | module:url~URLInfo

The URL of the resource.

typeMask number

The content types associated with the resource.

documentHostname string

The hostname of the document of the resource.

sitekey string <optional>
<nullable>
null

An optional public key associated with the document of the resource.

specificOnly boolean <optional>
false

Whether to ignore any generic filters.

Source:
Returns:

A URL filter if there's a match; otherwise null.

Type
string

(package) remove(filter)

Removes an existing filter.

Parameters:
Name Type Description
filter module:filterClasses.ActiveFilter
Source: