Set connection status values via constants

This commit is contained in:
JC Brand 2020-05-12 14:51:34 +02:00
parent c2143f617a
commit 2e6bfb6717

View File

@ -156,6 +156,19 @@ const DEFAULT_SETTINGS = {
}; };
const CONNECTION_STATUS = {};
CONNECTION_STATUS[Strophe.Status.ATTACHED] = 'ATTACHED';
CONNECTION_STATUS[Strophe.Status.AUTHENTICATING] = 'AUTHENTICATING';
CONNECTION_STATUS[Strophe.Status.AUTHFAIL] = 'AUTHFAIL';
CONNECTION_STATUS[Strophe.Status.CONNECTED] = 'CONNECTED';
CONNECTION_STATUS[Strophe.Status.CONNECTING] = 'CONNECTING';
CONNECTION_STATUS[Strophe.Status.CONNFAIL] = 'CONNFAIL';
CONNECTION_STATUS[Strophe.Status.DISCONNECTED] = 'DISCONNECTED';
CONNECTION_STATUS[Strophe.Status.DISCONNECTING] = 'DISCONNECTING';
CONNECTION_STATUS[Strophe.Status.ERROR] = 'ERROR';
CONNECTION_STATUS[Strophe.Status.RECONNECTING] = 'RECONNECTING';
CONNECTION_STATUS[Strophe.Status.REDIRECT] = 'REDIRECT';
/** /**
* A private, closured object containing the private api (via {@link _converse.api}) * A private, closured object containing the private api (via {@link _converse.api})
* as well as private methods and internal data-structures. * as well as private methods and internal data-structures.
@ -164,6 +177,7 @@ const DEFAULT_SETTINGS = {
*/ */
export const _converse = { export const _converse = {
log, log,
CONNECTION_STATUS,
'templates': {}, 'templates': {},
'promises': {}, 'promises': {},
@ -186,20 +200,6 @@ export const _converse = {
STANZA_TIMEOUT: 10000, STANZA_TIMEOUT: 10000,
CONNECTION_STATUS: {
0: 'ERROR',
1: 'CONNECTING',
2: 'CONNFAIL',
3: 'AUTHENTICATING',
4: 'AUTHFAIL',
5: 'CONNECTED',
6: 'DISCONNECTED',
7: 'DISCONNECTING',
8: 'ATTACHED',
9: 'REDIRECT',
10: 'RECONNECTING'
},
SUCCESS: 'success', SUCCESS: 'success',
FAILURE: 'failure', FAILURE: 'failure',