Class: Subscription

Subscription(url, titleopt)

new Subscription(url, titleopt)

Abstract base class for filter subscriptions
Parameters:
Name Type Attributes Description
url string download location of the subscription
title string <optional>
title of the filter subscription
Source:

Members

(static) knownSubscriptions :Map.<string, Subscription>

Cache for known filter subscriptions, maps URL to subscription objects.
Type:
Source:

(private) _filterText :Array.<string>

Filter text contained in the filter subscription.
Type:
  • Array.<string>
Source:

(private, nullable) _filterTextIndex :Set.<string>

A searchable index of filter text in the filter subscription.
Type:
  • Set.<string>
Source:

disabled :boolean

Defines whether the filters in the subscription should be disabled
Type:
  • boolean
Source:

filterCount :number

The number of filters in the subscription.
Type:
  • number
Source:

fixedTitle :boolean

Determines whether the title should be editable
Type:
  • boolean
Source:

title :string

Title of the filter subscription
Type:
  • string
Source:

(nullable) type :string

Type of the subscription
Type:
  • string
Source:

url :string

Download location of the subscription
Type:
  • string
Source:

Methods

(static) fromObject(obj) → {Subscription}

Deserializes a subscription
Parameters:
Name Type Description
obj Object map of serialized properties and their values
Source:
Returns:
subscription or null if the subscription couldn't be created
Type
Subscription

(static) fromURL(url) → {Subscription}

Returns a subscription from its URL, creates a new one if necessary.
Parameters:
Name Type Description
url string URL of the subscription
Source:
Returns:
subscription or null if the subscription couldn't be created
Type
Subscription

addFilter(filter)

Adds a filter to the subscription.
Parameters:
Name Type Description
filter Filter
Source:

addFilterText(filterText)

Adds a filter to the subscription.
Parameters:
Name Type Description
filterText string
Source:

clearFilters()

Removes all filters from the subscription.
Source:

deleteFilterAt(index)

Deletes a filter from the subscription.
Parameters:
Name Type Description
index number The index at which to delete the filter.
Source:

filterText() → {Iterator.<string>}

Returns an iterator that yields the text for each filter in the subscription.
Source:
Returns:
Type
Iterator.<string>

filterTextAt(index) → (nullable) {Filter}

Returns the filter text at the given 0-based index.
Parameters:
Name Type Description
index number
Source:
Returns:
Type
Filter

findFilterIndex(filter, fromIndexopt) → {number}

Returns the 0-based index of the given filter.
Parameters:
Name Type Attributes Description
filter Filter
fromIndex number <optional>
The index from which to start the search.
Source:
Returns:
Type
number

(package) hasFilterText(filterText) → {boolean}

Checks whether the subscription has the given filter text.
Parameters:
Name Type Description
filterText string
Source:
Returns:
Type
boolean

insertFilterAt(filter, index)

Inserts a filter into the subscription.
Parameters:
Name Type Description
filter Filter
index number The index at which to insert the filter.
Source:

serialize() → {string}

Serializes the subscription for writing out on disk.
Source:
Yields:
Type
string

(package) updateFilterText(filterText) → {Object}

Updates the filter text of the subscription.
Parameters:
Name Type Description
filterText Array.<string> The new filter text.
Source:
Returns:
An object containing two lists of the text of added and removed filters respectively.
Type
Object