Expand all

mw.echo.dm.NotificationsList

Extends

Constructor

new mw.echo.dm.NotificationsList(config) #

Notifications list data structure.

This contains the list of mw.echo.dm.NotificationItem items in the specified order and reflects when the list has changed.

Parameters:

Name Type Description
config Object

Configuration options

Source:
Notifications list data structure.

Properties

isGroup #

Defines whether or not this list contains items or lists of items.

Overrides:
Source:

Defines whether or not this list contains items or lists of items.

Methods

discardItems(items) #

Discard items from the list.

This is a more precise operation than 'removeItems' because when the list is resorting the position of a single item, it removes the item and reinserts it, which makes the 'remove' event unhelpful to differentiate between actually discarding items, and only temporarily moving them.

Parameters:

Name Type Description
items Array.<mw.echo.dm.NotificationItem>

Items to insert into the list

Source:

Fires:

Discard items from the list.

findByIds(ids) → {Array.<mw.echo.dm.NotificationItem>} #

Find all items that match the given IDs.

Parameters:

Name Type Description
ids Array.<number>

An array of item IDs

Source:

Returns:

An array of matching items

Type
Array.<mw.echo.dm.NotificationItem>
Find all items that match the given IDs.

getAllItemIds() → {Array.<number>} #

Get an array of all items' IDs.

Source:

Returns:

Item IDs

Type
Array.<number>
Get an array of all items' IDs.

getAllItemIdsByType(type) → {Array.<number>} #

Get an array of all items' IDs for a given type

Parameters:

Name Type Description
type string

Notification type

Source:

Returns:

Item IDs

Type
Array.<number>
Get an array of all items' IDs for a given type

getCount() → {number} #

A general method to get the number of notifications in this list

Source:

Returns:

Item count

Type
number
A general method to get the number of notifications in this list

getName() → {string} #

Get the name associated with this list.

Source:

Returns:

List name

Type
string
Get the name associated with this list.

getSource() → {string} #

Get the source associated with this list.

Source:

Returns:

List source

Type
string
Get the source associated with this list.

getSourceURL() → {string} #

Get the source article url associated with this list.

Source:

Returns:

List source article url

Type
string
Get the source article url associated with this list.

getTimestamp() → {string} #

Get the timestamp of the list by taking the latest notification timestamp.

Source:

Returns:

Latest timestamp

Type
string

Get the timestamp of the list by taking the latest notification timestamp.

getTitle() → {string} #

Get the title associated with this list.

Source:

Returns:

List title

Type
string
Get the title associated with this list.

hasUnseen() → {boolean} #

Check if there are unseen items in this list

Source:

Returns:

There are unseen items in the list

Type
boolean
Check if there are unseen items in this list

setItems(items) #

Set the items in this list

Parameters:

Name Type Description
items Array.<mw.echo.dm.NotificationItem>

Items to insert into the list

Source:

Fires:

Set the items in this list

updateSeenState(timestamp) #

Set all notifications to seen

Parameters:

Name Type Description
timestamp string

New seen timestamp

Source:
Set all notifications to seen

Events

discard(item) #

An item was discarded

Parameters:

Name Type Description
item mw.echo.dm.NotificationItem

Item that was discarded

Source:
An item was discarded

itemUpdate(item) #

An item in the list has been updated

Parameters:

Name Type Description
item mw.echo.dm.NotificationItem

Item that has changed

Source:
An item in the list has been updated

update(items) #

The list has been updated

Parameters:

Name Type Description
items Array.<mw.echo.dm.NotificationItem>

Current items in the list

Source:
The list has been updated