Extends
Constructor
new mw.echo.ui.NotificationsListWidget(controller, manager, [config])
#
Notifications list widget. All of its items must be of the mw.echo.ui.NotificationItem type.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
controller |
mw.echo.Controller | Echo notifications controller |
|
manager |
mw.echo.dm.ModelManager | Model manager |
|
config |
Object |
optional |
Configuration object marked as read when they are seen. |
Methods
attachItemToDom(item, index)
#
Attach the item to the Dom in its intended position, based on the given index.
Parameters:
Name | Type | Description |
---|---|---|
item |
OO.EventEmitter | Item |
index |
number | Index to insert the item into |
- Inherited from:
- Source:
Attach the item to the Dom in its intended position, based on the given index.
attachModel(modelId, model)
#
Attach a model to the widget
Parameters:
Name | Type | Description |
---|---|---|
modelId |
string | Symbolic name for the model |
model |
mw.echo.dm.SortedList | Notifications list model |
checkForEmptyNotificationsList()
#
Check if the list of notifications is empty and udpate the placeholder widget as needed.
Check if the list of notifications is empty and udpate the placeholder widget as needed.
clearItems() → {mw.echo.ui.SortedListWidget}chainable
#
Clear all items
- Inherited from:
- Source:
Fires:
Returns:
detachModel(modelId)
#
Detach a model from the widget
Parameters:
Name | Type | Description |
---|---|---|
modelId |
string | Notifications list model |
findItemFromData(data) → {OO.ui.Element|null
}
#
null
}
#
Get an item by its data.
Parameters:
Name | Type | Description |
---|---|---|
data |
string | Item data to search for |
- Inherited from:
- Source:
Returns:
Item with equivalent data, null
if none exists
- Type
-
OO.ui.Element
|
null
getItemFromId(id) → {OO.ui.Element|null
}
#
null
}
#
Get an item by its id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Item id to search for |
- Inherited from:
- Source:
Returns:
Item with equivalent data, null
if none exists
- Type
-
OO.ui.Element
|
null
getTimestamp() → {string}
#
Get the timestamp of the list by taking the latest notification timestamp.
- Inherited from:
- Source:
Returns:
Latest timestamp
- Type
- string
Get the timestamp of the list by taking the latest notification timestamp.
insertItem(item, index) → {number}private
#
Utility method to insert an item into the list, and connect it to aggregate events.
Don't call this directly unless you know what you're doing. Use #addItems instead.
Parameters:
Name | Type | Description |
---|---|---|
item |
OO.EventEmitter | Items to add |
index |
number | Index to add items at |
- Inherited from:
- Source:
Returns:
The index the item was added at
- Type
- number
Utility method to insert an item into the list, and connect it to aggregate events.
moveItem(item, index) → {number}private
#
Move an item from its current position to a new index.
The item is expected to exist in the list. If it doesn't, the method will throw an exception.
Parameters:
Name | Type | Description |
---|---|---|
item |
OO.EventEmitter | Items to add |
index |
number | Index to move the item to |
- Inherited from:
- Source:
Throws:
-
If item is not in the list
- Type
- Error
Returns:
The index the item was moved to
- Type
- number
onItemSortChange()
#
- Inherited from:
- Source:
removeItems(items) → {mw.echo.ui.SortedListWidget}chainable
#
Remove items.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<OO.EventEmitter> | Items to remove |
- Inherited from:
- Source:
Fires:
Returns:
resetDataFromModel(models)
#
Respond to model manager update event. This event means we are repopulating the entire list and the associated models within it.
Parameters:
Name | Type | Description |
---|---|---|
models |
Object | Object of new models to populate the list. |
Fires:
resetInitiallyUnseenItems()
#
Reset the 'initiallyUnseen' state of all items
resetLoadingOption([label], [link])
#
Reset the loading 'dummy' option widget
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
label |
string |
optional |
Label for the option widget |
link |
string |
optional |
Link for the option widget |
Fires:
setGroupElement($group)
#
Set the group element.
If an element is already set, items will be moved to the new element.
Parameters:
Name | Type | Description |
---|---|---|
$group |
jQuery | Element to use as group |
- Inherited from:
- Source:
Events
modified()
#
The content of this list has changed. This event is to state that not only has the content changed but the actual DOM has been manipulated.