Emit new event ``afterMessagesFetched``

This commit is contained in:
JC Brand 2017-07-21 15:01:35 +02:00
parent a9589cba71
commit 0a47f60f94
3 changed files with 28 additions and 0 deletions

View File

@ -20,6 +20,10 @@
* [emojione_image_path](https://conversejs.org/docs/html/configurations.html#emojione-image-path)
is used to specify from where Emojione will load images for rendering emojis.
### New events
* ['discoInitialized'](https://conversejs.org/docs/html/development.html#discoInitialized)
* ['afterMessagesFetched'](https://conversejs.org/docs/html/development.html#afterMessagesFetched)
### Code changes
- Removed jQuery from `converse-core`, `converse-vcard` and `converse-roomslist`. [jcbrand]
- Remove `jquery.easing` from the full build. Was only being used by the

View File

@ -27,6 +27,20 @@ Refer to the :ref:`whitelisted_plugins` setting.
Here follows the different events that are emitted:
afterMessagesFetched
~~~~~~~~~~~~~~~~~~~~
Emitted whenever a chat box has fetched its messages from ``sessionStorage`` and
**NOT** from the server.
This event is listened to by the ``converse-mam`` plugin to know when it can
fetch archived messages from the server.
The event handler is passed the ``Backbone.View`` instance of the relevant chat
box.
``_converse.on('afterMessagesFetched', function (chatboxview) { ... });``
cachedRoster
~~~~~~~~~~~~
@ -121,6 +135,15 @@ When a chat buddy's custom status message has changed.
``_converse.on('contactStatusMessageChanged', function (data) { ... });``
discoInitialized
~~~~~~~~~~~~~~~~
Emitted once the ``converse-disco`` plugin has been initialized and the
``_converse.disco_entities`` collection will be available and populated with at
least the service discovery features of the user's own server.
``_converse.on('discoInitialized', function () { ... });``
disconnected
~~~~~~~~~~~~

View File

@ -290,6 +290,7 @@
// We only start listening for the scroll event after
// cached messages have been fetched
this.$content.on('scroll', this.markScrolled.bind(this));
_converse.emit('afterMessagesFetched', this);
},
fetchMessages () {