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 |
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 |
Fires:
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 |
Returns:
An array of matching items
- Type
- Array.<mw.echo.dm.NotificationItem>
getAllItemIds() → {Array.<number>}
#
getAllItemIdsByType(type) → {Array.<number>}
#
Get an array of all items' IDs for a given type
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Notification type |
Returns:
Item IDs
- Type
- Array.<number>
getCount() → {number}
#
A general method to get the number of notifications in this list
Returns:
Item count
- Type
- number
getName() → {string}
#
Get the name associated with this list.
Returns:
List name
- Type
- string
getSource() → {string}
#
Get the source associated with this list.
Returns:
List source
- Type
- string
getSourceURL() → {string}
#
Get the source article url associated with this list.
Returns:
List source article url
- Type
- string
getTimestamp() → {string}
#
Get the timestamp of the list by taking the latest notification timestamp.
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.
Returns:
List title
- Type
- string
hasUnseen() → {boolean}
#
Check if there are unseen items in this list
Returns:
There are unseen items in the list
- Type
- boolean
setItems(items)
#
Set the items in this list
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<mw.echo.dm.NotificationItem> | Items to insert into the list |
Fires:
updateSeenState(timestamp)
#
Set all notifications to seen
Parameters:
Name | Type | Description |
---|---|---|
timestamp |
string | New seen timestamp |
Events
discard(item)
#
An item was discarded
Parameters:
Name | Type | Description |
---|---|---|
item |
mw.echo.dm.NotificationItem | Item that 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 |
update(items)
#
The list has been updated
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<mw.echo.dm.NotificationItem> | Current items in the list |