Add 'connection' API grouping and 'connected' API method.

This commit is contained in:
JC Brand 2016-03-29 13:41:10 +00:00
parent 556d264747
commit a6b6ad5e9e
2 changed files with 23 additions and 2 deletions

View File

@ -378,6 +378,22 @@ message, pass in the ``before`` parameter with an empty string value ``''``.
converse.archive.query(rsm, callback, errback);
}
The "connection" grouping
-------------------------
This grouping collects API functions related to the XMPP connection.
connected
~~~~~~~~~
Returns a boolean value (`true` or `false`) depending on whether there is an
established connection.
disconnect
~~~~~~~~~~
Terminates the connection.
The "user" grouping
-------------------

View File

@ -25,9 +25,14 @@
'initialize': function (settings, callback) {
converse.initialize(settings, callback);
},
'connection': {
'connected': function () {
return converse.connection.connected;
},
'disconnect': function () {
converse.connection.disconnect();
},
},
'user': {
'logout': function () {
converse.logOut();