Class: FilterComponent

filter-component~FilterComponent

new FilterComponent(the)

FilterComponent is a section of a Filter definition which defines the types, rooms, senders filters etc to be applied to a particular type of resource. This is all ported over from synapse's Filter object. N.B. that synapse refers to these as 'Filters', and what js-sdk refers to as 'Filters' are referred to as 'FilterCollections'.
Parameters:
Name Type Description
the Object definition of this filter JSON, e.g. { 'contains_url': true }
Source:

Methods

_checkFields(room_id, sender, event_type, contains_url) → {bool}

Checks whether the filter component matches the given event fields.
Parameters:
Name Type Description
room_id String the room_id for the event being checked
sender String the sender of the event being checked
event_type String the type of the event being checked
contains_url String whether the event contains a content.url field
Source:
Returns:
true if the event fields match the filter
Type
bool

check(event) → {bool}

Checks with the filter component matches the given event
Parameters:
Name Type Description
event MatrixEvent event to be checked against the filter
Source:
Returns:
true if the event matches the filter
Type
bool

filter(events) → {Array.<MatrixEvent>}

Filters a list of events down to those which match this filter component
Parameters:
Name Type Description
events Array.<MatrixEvent> Events to be checked againt the filter component
Source:
Returns:
events which matched the filter component
Type
Array.<MatrixEvent>

limit() → {Number}

Returns the limit field for a given filter component, providing a default of 10 if none is otherwise specified. Cargo-culted from Synapse.
Source:
Returns:
the limit for this filter component.
Type
Number