Extends
Constructor
new mw.echo.dm.NotificationGroupsList([config])
#
Notification groups list data structure.
It contains mw.echo.dm
.NotificationsList items
This contains a list of grouped notifications by source, and serves as a list of lists for cross-wiki notifications based on their remote sources and/or wikis.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
Object |
optional |
Configuration options |
Properties
isGroup
#
Defines whether or not this list contains items or lists of items.
- Inherited from:
- Source:
Defines whether or not this list contains items or lists of items.
Methods
addGroup(groupSource, sourceData, [groupItems])
#
Add a group to the list. This is a more convenient alias to using addItems()
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
groupSource |
string | Symbolic name for the source of this group, to be recognized for API operations |
|
sourceData |
Object | Source data |
|
groupItems |
Array.<mw.echo.dm.NotificationItem> |
optional |
Optional items to add to this group |
addItemsToGroup(groupSource, groupItems)
#
Add items to a specific group by its source identifier.
Parameters:
Name | Type | Description |
---|---|---|
groupSource |
string | Source identifier of the group |
groupItems |
Array.<mw.echo.dm.NotificationItem> | Items to add to this group |
getGroupByName(groupName) → {mw.echo.dm.NotificationsList|null
}
#
null
}
#
Get a group by its source identifier.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Group name |
Returns:
Requested group, null if none was found.
- Type
-
mw.echo.dm.NotificationsList
|
null
getTimestamp() → {string}
#
Get the timestamp of the list by taking the latest list's timestamp.
Returns:
Latest timestamp
- Type
- string
Get the timestamp of the list by taking the latest list's timestamp.
onGroupDiscardItem(groupList)
#
Handle a discard event from any list. This means that one of the sources has discarded an item.
Parameters:
Name | Type | Description |
---|---|---|
groupList |
mw.echo.dm.NotificationsList | List source model for the item |
removeGroup(groupName)
#
Remove a group from the list. This is an easier to use alias to 'removeItems()' method.
Since this is an intentional action, we fire 'discard' event. The main reason for this is that the event 'remove' is a general event that is fired both when a user intends on removing an item and also when an item is temporarily removed to be re-added for the sake of sorting. To avoid ambiguity, we use 'discard' event.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Group name |
Fires:
Events
discard()
#
A group was permanently removed