MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / scheduleReconnect

Function scheduleReconnect

www/js/ext/eventsource.esm.js:300–309  ·  view source on GitHub ↗
(stub, baseDelay)

Source from the content-addressed store, hash-verified

298 }
299}
300function scheduleReconnect(stub, baseDelay) {
301 if (stub.closed) return;
302 baseDelay = baseDelay || 500;
303 stub.retryCount = Math.min(7, stub.retryCount + 1);
304 var timeout = Math.random() * 2 ** stub.retryCount * baseDelay;
305 stub.reconnectTimeout = setTimeout(function() {
306 stub.reconnectTimeout = null;
307 if (!stub.closed) startConnection(stub);
308 }, timeout);
309}
310function dispatch(stub, eventType, evt) {
311 for (var i = 0; i < stub.listeners.length; i++) {
312 var listener = stub.listeners[i];

Callers 2

startConnectionFunction · 0.70
readStreamFunction · 0.70

Calls 2

startConnectionFunction · 0.70
setTimeoutFunction · 0.50

Tested by

no test coverage detected