Class: DownloadableSubscription

(private) subscriptionClasses.DownloadableSubscription(url, titleopt)

The DownloadableSubscription class represents a regular filter subscription that is downloaded by Adblock Plus.

Constructor

(private) new DownloadableSubscription(url, titleopt)

Creates a DownloadableSubscription object.

Parameters:
Name Type Attributes Description
url string

The URL of the subscription.

title string <optional>

The title of the subscription.

Source:

Extends

Members

(private) _disabled :boolean

Whether the subscription is disabled.

Type:
  • boolean
Overrides:
Default Value:
  • false
Source:
See:

(private, nullable) _downloadStatus :string

The status of the last download.

Type:
  • string
Default Value:
  • null
Source:
See:

(private) _errors :number

The number of download failures since the last successful download.

Type:
  • number
Default Value:
  • 0
Source:
See:

(private) _filterText :Array.<string>

Filter text contained in the subscription.

Type:
  • Array.<string>
Overrides:
Source:

(private) _filterTextIndex :Set.<string>

A searchable index of filter text in the subscription.

Type:
  • Set.<string>
Overrides:
Source:

(private) _fixedTitle :boolean

Whether the title of the subscription is non-editable.

Type:
  • boolean
Overrides:
Default Value:
  • false
Source:
See:

(private, nullable) _homepage :string

The homepage of the subscription.

Type:
  • string
Overrides:
Default Value:
  • null
Source:
See:

(private) _lastCheck :number

The last time the subscription was considered for an update, in seconds since the beginning of the Unix epoch.

Type:
  • number
Default Value:
  • 0
Source:
See:

(private) _lastDownload :number

The last time the subscription was downloaded, in seconds since the beginning of the Unix epoch.

Type:
  • number
Overrides:
Default Value:
  • 0
Source:
See:

(private, nullable) _title :string

The title of the subscription.

Type:
  • string
Overrides:
Default Value:
  • null
Source:
See:

(private, nullable) _type :string

The type of the subscription.

Type:
  • string
Overrides:
Default Value:
  • null
Source:
See:

(private) _url :string

The URL of the subscription.

Type:
  • string
Overrides:
Source:
See:

(private) _urlValid :boolean

Whether the URL of the subscription is a valid subscription URL.

Type:
  • boolean
Overrides:
Source:
See:

disabled :boolean

Whether the subscription is disabled. Once re-enabled, it ensures the synchronizer downloads latest version of this subscription.

Type:
  • boolean
Overrides:
Default Value:
  • false
Source:

downloadCount :number

The number of times the subscription has been downloaded.

Type:
  • number
Default Value:
  • 0
Source:

(nullable) downloadStatus :string

The status of the last download.

A message ID which can have the following values: synchronize_ok, synchronize_connection_error or synchronize_invalid_url. If the initial download is not completed yet, then it is null.

Type:
  • string
Default Value:
  • null
Source:

errors :number

The number of download failures since the last successful download.

Type:
  • number
Default Value:
  • 0
Source:

expires :number

The hard expiration time of the subscription, in seconds since the beginning of the Unix epoch.

Updates should be downloaded if module:subscriptionClasses.DownloadableSubscription#softExpiration or expires are in the past.

Type:
  • number
Default Value:
  • 0
Source:

filterCount :number

The number of filters in the subscription.

Type:
  • number
Overrides:
Default Value:
  • 0
Source:

fixedTitle :boolean

Whether the title of the subscription is non-editable.

Type:
  • boolean
Overrides:
Default Value:
  • false
Source:

(nullable) homepage :string

The homepage of the subscription.

Type:
  • string
Overrides:
Default Value:
  • null
Source:

lastCheck :number

The last time the subscription was considered for an update, in seconds since the beginning of the Unix epoch.

This is used to increase the soft expiration time if the user doesn't use Adblock Plus for some time.

Type:
  • number
Default Value:
  • 0
Source:

lastDownload :number

The last time the subscription was downloaded, in seconds since the beginning of the Unix epoch.

Type:
  • number
Overrides:
Default Value:
  • 0
Source:

lastSuccess :number

The last time the subscription was successfully downloaded, in seconds since the beginning of the Unix epoch.

Type:
  • number
Default Value:
  • 0
Source:

privileged :bool

True if this subscription can load filters that require privileged access, like snippets.

Type:
  • bool
Overrides:
Source:

(nullable) requiredVersion :string

The minimal Adblock Plus version required for the subscription.

Type:
  • string
Default Value:
  • null
Source:

softExpiration :number

The soft expiration time of the subscription, in seconds since the beginning of the Unix epoch.

Updates should be downloaded if softExpiration or module:subscriptionClasses.DownloadableSubscription#expires are in the past.

Type:
  • number
Default Value:
  • 0
Source:

title :string

The title of the subscription.

Type:
  • string
Overrides:
Source:

(nullable) type :string

The type of the subscription.

Type:
  • string
Overrides:
Default Value:
  • null
Source:

url :string

The URL of the subscription.

Type:
  • string
Overrides:
Source:

(package) valid :boolean

Whether the subscription is valid.

Type:
  • boolean
Overrides:
Source:

version :number

The version of the subscription data that was retrieved on last successful download.

Type:
  • number
Default Value:
  • 0
Source:

Methods

(static) useSynchronizer(reference)

Allows downloadable subscriptions to update themselves once re-enabled, via receiving the Synchronizer singleton.

Parameters:
Name Type Description
reference module:synchronizer~Synchronizer

the Synchronizer

Source:

addFilter(filter)

Adds a filter to the subscription.

Parameters:
Name Type Description
filter Filter

The filter.

Overrides:
Source:

clearFilters()

Removes all filters from the subscription.

Overrides:
Source:

deleteFilterAt(index)

Deletes a filter from the subscription at the given 0-based index.

Parameters:
Name Type Description
index number

The 0-based index. If the index is out of bounds, no filter is deleted.

Overrides:
Source:

filterText() → {Iterator.<string>}

Returns an iterator that yields the text for each filter in the subscription.

Overrides:
Source:
Returns:
Type
Iterator.<string>

filterTextAt(index) → (nullable) {module:filterClasses.Filter}

Returns the filter text at the given 0-based index.

Parameters:
Name Type Description
index number

The 0-based index. If the index is out of bounds, the return value is null.

Overrides:
Source:
Returns:

The filter text.

Type
module:filterClasses.Filter

findFilterIndex(filter, fromIndexopt) → {number}

Returns the 0-based index of the given filter.

Parameters:
Name Type Attributes Default Description
filter module:filterClasses.Filter

The filter.

fromIndex number <optional>
0

The 0-based index from which to start the search.

Overrides:
Source:
Returns:

The 0-based index at which the filter is found. If the filter is not found in the subscription, the return value is -1.

Type
number

(package) hasFilterText(filterText) → {boolean}

Checks whether the subscription has the given filter text.

Parameters:
Name Type Description
filterText string

The filter text.

Overrides:
Source:
Returns:

Whether the subscription has the filter text.

Type
boolean

insertFilterAt(filter, index)

Inserts a filter into the subscription at the given 0-based index.

Parameters:
Name Type Description
filter module:filterClasses.Filter

The filter.

index number

The 0-based index. If the index is out of bounds, the filter is inserted at the beginning or at the end accordingly.

Overrides:
Source:

mark(event)

Put a benchmarking event

Parameters:
Name Type Description
event string

benchmarking event

Source:

(generator, package) serialize() → {string}

Serializes the subscription for writing out on disk.

Overrides:
Source:
Yields:
Type
string

(generator, package) serializeFilters() → {string}

Serializes the subscription's filter text for writing out on disk.

Overrides:
Source:
Yields:
Type
string

toString() → {string}

Returns a string representing the subscription.

Overrides:
Source:
Returns:
Type
string

(package) updateFilterText(filterText) → {Object}

Updates the filter text of the subscription.

Parameters:
Name Type Description
filterText Array.<string>

The new filter text.

Overrides:
Source:
Returns:

An object containing two lists of the text of added and removed filters respectively.

Type
Object