@firebase/storage 0.8.6 → 0.8.7-20211010221442

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -355,7 +355,9 @@ callback, timeout) {
355
355
  // Would type this as "number" but that doesn't work for Node so ¯\_(ツ)_/¯
356
356
  // TODO: find a way to exclude Node type definition for storage because storage only works in browser
357
357
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
358
- var timeoutId = null;
358
+ var retryTimeoutId = null;
359
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
360
+ var globalTimeoutId = null;
359
361
  var hitTimeout = false;
360
362
  var cancelState = 0;
361
363
  function canceled() {
@@ -373,25 +375,33 @@ callback, timeout) {
373
375
  }
374
376
  }
375
377
  function callWithDelay(millis) {
376
- timeoutId = setTimeout(function () {
377
- timeoutId = null;
378
+ retryTimeoutId = setTimeout(function () {
379
+ retryTimeoutId = null;
378
380
  f(handler, canceled());
379
381
  }, millis);
380
382
  }
383
+ function clearGlobalTimeout() {
384
+ if (globalTimeoutId) {
385
+ clearTimeout(globalTimeoutId);
386
+ }
387
+ }
381
388
  function handler(success) {
382
389
  var args = [];
383
390
  for (var _i = 1; _i < arguments.length; _i++) {
384
391
  args[_i - 1] = arguments[_i];
385
392
  }
386
393
  if (triggeredCallback) {
394
+ clearGlobalTimeout();
387
395
  return;
388
396
  }
389
397
  if (success) {
398
+ clearGlobalTimeout();
390
399
  triggerCallback.call.apply(triggerCallback, __spreadArray([null, success], args));
391
400
  return;
392
401
  }
393
402
  var mustStop = canceled() || hitTimeout;
394
403
  if (mustStop) {
404
+ clearGlobalTimeout();
395
405
  triggerCallback.call.apply(triggerCallback, __spreadArray([null, success], args));
396
406
  return;
397
407
  }
@@ -415,14 +425,15 @@ callback, timeout) {
415
425
  return;
416
426
  }
417
427
  stopped = true;
428
+ clearGlobalTimeout();
418
429
  if (triggeredCallback) {
419
430
  return;
420
431
  }
421
- if (timeoutId !== null) {
432
+ if (retryTimeoutId !== null) {
422
433
  if (!wasTimeout) {
423
434
  cancelState = 2;
424
435
  }
425
- clearTimeout(timeoutId);
436
+ clearTimeout(retryTimeoutId);
426
437
  callWithDelay(0);
427
438
  }
428
439
  else {
@@ -432,7 +443,7 @@ callback, timeout) {
432
443
  }
433
444
  }
434
445
  callWithDelay(0);
435
- setTimeout(function () {
446
+ globalTimeoutId = setTimeout(function () {
436
447
  hitTimeout = true;
437
448
  stop(true);
438
449
  }, timeout);
@@ -3276,7 +3287,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
3276
3287
  }());
3277
3288
 
3278
3289
  var name = "@firebase/storage";
3279
- var version = "0.8.6";
3290
+ var version = "0.8.7-20211010221442";
3280
3291
 
3281
3292
  /**
3282
3293
  * @license