Class: SpecialSubscription

(private) subscriptionClasses.SpecialSubscription(url, titleopt)

The SpecialSubscription class represents a special filter subscription.

This type of subscription is used for keeping user-defined filters.

Constructor

(private) new SpecialSubscription(url, titleopt)

Creates a SpecialSubscription object.

Parameters:
Name Type Attributes Description
url string

The URL of the subscription.

title string <optional>

The title of the subscription.

Source:

Extends

Members

(package, static) defaultsMap :Map.<string, Array.<string>>

A map of filter types.

Type:
  • Map.<string, Array.<string>>
Source:

(private) _disabled :boolean

Whether the subscription is disabled.

Type:
  • boolean
Overrides:
Default Value:
  • false
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) _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:

(package, nullable) defaults :Array.<string>

Filter types that should be added to this subscription by default.

Entries should correspond to keys in module:subscriptionClasses.SpecialSubscription.defaultsMap.

Type:
  • Array.<string>
Source:

disabled :boolean

Whether the subscription is disabled.

Type:
  • boolean
Overrides:
Default Value:
  • false
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:

metadata

Set the metadata block for the special subscription

Source:

metadata

Get the metadata block.

Source:

privileged :bool

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

Type:
  • bool
Overrides:
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:

Methods

(package, static) create(titleopt) → {module:subscriptionClasses.SpecialSubscription}

Creates a new special subscription.

Parameters:
Name Type Attributes Description
title string <optional>

The title of the subscription.

Source:
Returns:

A new special subscription.

Type
module:subscriptionClasses.SpecialSubscription

(package, static) createForFilter(filter) → {module:subscriptionClasses.SpecialSubscription}

Creates a new special subscription and adds the given filter to it.

Once created, the subscription acts as the default for all filters of the type.

Parameters:
Name Type Description
filter module:filterClasses.Filter

The filter.

Source:
Returns:

A new special subscription.

Type
module:subscriptionClasses.SpecialSubscription

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:

(package) isDefaultFor(filter) → {boolean}

Checks whether the given filter should be added to this subscription by default.

Parameters:
Name Type Description
filter Filter

The filter.

Source:
Returns:

Whether the filter should be added to this subscription by default.

Type
boolean

(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