Handle Connect State Change
<String> LViS.ConnectionManager.ON_STATE
LViS.ConnectionManager.STATE_DISCONNECTED
does not expose any other parameters.LViS.ConnectionManager.STATE_CONNECTING
provides connect attempt and delay before the next attempt will occur.LViS.ConnectionManager.STATE_CONNECTED
provides correct server time.
// shorthand
var Connect = LViS.ConnectionManager;
Connect.bind(Connect.ON_STATE, function () {
var state = arguments[0];
switch (state) {
case Connect.STATE_DISCONNECTED:
// show disconnected method
break;
case Connect.STATE_CONNECTING:
var attempt = arguments[1],
delay = arguments[2];
if (attempt >= 1) {
// show connection bar
}
break;
case Connect.STATE_CONNECTED:
var serverTime = arguments[1];
// hide connection bar if it has been shown before
break;
}
});
Last modified 3yr ago