Use an event instead of an override
This commit is contained in:
parent
5e97db95f9
commit
195a9781c1
|
@ -294,24 +294,6 @@ Also available as an `ES2015 Promise <http://es6-features.org/#PromiseUsage>`_:
|
|||
// Your code here...
|
||||
});
|
||||
|
||||
reconnecting
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Fired once converse.js has determined that it will attempt to reconnect (and
|
||||
each subsequent time, if it attempts repeatedly).
|
||||
|
||||
reconnected
|
||||
~~~~~~~~~~~
|
||||
|
||||
After the connection has dropped and converse.js has reconnected.
|
||||
Any Strophe stanza handlers (as registered via `converse.listen.stanza`) will
|
||||
have to be registered anew.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
_converse.api.listen.on('reconnected', function () { ... });
|
||||
|
||||
|
||||
privateChatsAutoJoined
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -330,6 +312,33 @@ Also available as an `ES2015 Promise <http://es6-features.org/#PromiseUsage>`_.
|
|||
// Your code here...
|
||||
});
|
||||
|
||||
|
||||
reconnecting
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Fired once converse.js has determined that it will attempt to reconnect (and
|
||||
each subsequent time, if it attempts repeatedly).
|
||||
|
||||
reconnected
|
||||
~~~~~~~~~~~
|
||||
|
||||
After the connection has dropped and converse.js has reconnected.
|
||||
Any Strophe stanza handlers (as registered via `converse.listen.stanza`) will
|
||||
have to be registered anew.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
_converse.api.listen.on('reconnected', function () { ... });
|
||||
|
||||
registeredGlobalEventHandlers
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Called once Converse has registered its global event handlers (for events such
|
||||
as window resize or unload).
|
||||
|
||||
Plugins can listen to this event as cue to register their own global event
|
||||
handlers.
|
||||
|
||||
roomsAutoJoined
|
||||
---------------
|
||||
|
||||
|
|
|
@ -726,6 +726,7 @@
|
|||
if( document[hidden] !== undefined ) {
|
||||
_.partial(_converse.saveWindowState, _, hidden)({type: document[hidden] ? "blur" : "focus"});
|
||||
}
|
||||
_converse.emit('registeredGlobalEventHandlers');
|
||||
};
|
||||
|
||||
this.enableCarbons = function () {
|
||||
|
|
|
@ -52,16 +52,6 @@
|
|||
//
|
||||
// New functions which don't exist yet can also be added.
|
||||
|
||||
registerGlobalEventHandlers () {
|
||||
const { _converse } = this.__super__;
|
||||
window.addEventListener("resize", _.debounce(function (ev) {
|
||||
if (_converse.connection.connected) {
|
||||
_converse.chatboxviews.trimChats();
|
||||
}
|
||||
}, 200));
|
||||
return this.__super__.registerGlobalEventHandlers.apply(this, arguments);
|
||||
},
|
||||
|
||||
ChatBox: {
|
||||
initialize () {
|
||||
this.__super__.initialize.apply(this, arguments);
|
||||
|
@ -541,6 +531,15 @@
|
|||
_converse.emit('minimizedChatsInitialized');
|
||||
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
|
||||
|
||||
|
||||
_converse.on('registeredGlobalEventHandlers', function () {
|
||||
window.addEventListener("resize", _.debounce(function (ev) {
|
||||
if (_converse.connection.connected) {
|
||||
_converse.chatboxviews.trimChats();
|
||||
}
|
||||
}, 200));
|
||||
});
|
||||
|
||||
_converse.on('controlBoxOpened', function (chatbox) {
|
||||
// Wrapped in anon method because at scan time, chatboxviews
|
||||
// attr not set yet.
|
||||
|
|
Loading…
Reference in New Issue
Block a user