mediawiki-extensions-Echo/modules/hooks.txt
Moriel Schottlender e9264022a7 (re)Add JavaScript hooks to Notifications
Added the following Javascript hooks:
* ext.echo.notifications.beforeRender: Firing before a group of
  notification widgets are rendered, whether in the popup, in
  the special page, or in a cross-wiki bundle (which requires
  async loading)
* ext.echo.badge.countChange: Fired when the badge count changes
  with the notification type, count and the label count for
  display purposes.
* ext.echo.popup.onInitialize: Fired when the popup is opened and
  after notifications were fetched, with the context of the popup
  notification type.
* ext.echo.special.onInitialize: Fired when the special page is
  ready and notifications were fetched. Note that it will be fired
  whenever the special page is updated with notifications list,
  as well, like when changing filter, remote wiki or pagination.

The hooks were also documented in hooks.txt

Bug: T146296
Change-Id: Ie3dc97f97e8d1f90b67f62fcdc65dd29cb379aad
2016-10-14 17:25:25 -05:00

27 lines
1.5 KiB
Plaintext

hooks.txt
This documents Echo's client-side hooks:
'ext.echo.notifications.beforeRender': Before notification widgets are rendered
the wrapper of the notifications and the individual notification jQuery elements
are passed to this hook, which can modify the DOM or take other actions.
* $wrapper: The jQuery object that is the wrapper for the notification items
* $elements: A jQuery group of all notification elements that are about to be rendered.
'ext.echo.badge.countChange': When the count changes in the Notifications popup
badge, this hook is fired with the new count.
* type: Notifications type that the badge represents. Can be 'message', 'alert' or 'all'
* count: The new numerical count in the notifications popup.
* label: The label for this number, for presentation purposes.
'ext.echo.popup.onInitialize': Fired when the popup is opened and after notifications
were fetched from the API.
* types: Notifications type that the badge represents. Can be 'message', 'alert' or 'all'
* controller: The instance of the controller responsible for the specific popup operations
'ext.echo.special.onInitialize': Fired when the special page is initialized. Note that this
is also fired whenever the special page notification display is changed, like when clicking
a filter, changing pagination, or viewing notifications for a remote wiki or page.
* types: Notifications type that the badge represents. Can be 'message', 'alert' or 'all'
* controller: The instance of the controller responsible for the specific popup operations