function disconnectWhenSendBufferIsDrained (bufferDrainRetries) {
          if (!webSocket) return;

          if (bufferDrainRetries === void 0) bufferDrainRetries = 0;
          if (bufferDrainTimeout) clearTimeout(bufferDrainTimeout);

          if (webSocket.bufferedAmount > 0 &&
            (bufferDrainRetries + 1) <= BUFFER_DRAIN_MAX_RETRIES) {
            bufferDrainTimeout = setTimeout(disconnectWhenSendBufferIsDrained,
              BUFFER_DRAIN_INTERVAL, bufferDrainRetries+1);
          }
          else {
            close();
          }
        }
// we give up and close it anyway.
we give up and close it anyway.
we give up and close it anyway .
function disconnectWhenSendBufferIsDrained (bufferDrainRetries) {
          if (!webSocket) return;
          if (bufferDrainRetries === void 0) bufferDrainRetries = 0;
          if (bufferDrainTimeout) clearTimeout(bufferDrainTimeout);
          if (webSocket.bufferedAmount > 0 &&
            (bufferDrainRetries + 1) <= BUFFER_DRAIN_MAX_RETRIES) {
            bufferDrainTimeout = setTimeout(disconnectWhenSendBufferIsDrained,
              BUFFER_DRAIN_INTERVAL, bufferDrainRetries+1);
          }
          else {
            close();
          }
        }
function disconnectWhenSendBufferIsDrained ( bufferDrainRetries ) { if ( ! webSocket ) return ; if ( bufferDrainRetries === void 0 ) bufferDrainRetries = 0 ; if ( bufferDrainTimeout ) clearTimeout ( bufferDrainTimeout ) ; if ( webSocket . bufferedAmount > 0 && ( bufferDrainRetries + 1 ) <= BUFFER_DRAIN_MAX_RETRIES ) { bufferDrainTimeout = setTimeout ( disconnectWhenSendBufferIsDrained , BUFFER_DRAIN_INTERVAL , bufferDrainRetries + 1 ) ; } else { close ( ) ; } }
we give up and close it anyway.
we give up and close it anyway .