@microsoft/applicationinsights-channel-js 3.0.0-beta.2210-17 → 3.0.0-beta.2210-19

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.
package/src/Sender.ts CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  dateNow, dumpObj, eLoggingSeverity, getExceptionName, getIEVersion, getJSON, getNavigator, getWindow, isArray, isBeaconsSupported,
12
12
  isFetchSupported, isNullOrUndefined, isXhrSupported, mergeEvtNamespace, objExtend, objKeys, onConfigChange, useXDomainRequest
13
13
  } from "@microsoft/applicationinsights-core-js";
14
- import { isTruthy, objDeepFreeze, objDefineProp } from "@nevware21/ts-utils";
14
+ import { ITimerHandler, isTruthy, objDeepFreeze, objDefineProp, scheduleTimeout } from "@nevware21/ts-utils";
15
15
  import {
16
16
  DependencyEnvelopeCreator, EventEnvelopeCreator, ExceptionEnvelopeCreator, MetricEnvelopeCreator, PageViewEnvelopeCreator,
17
17
  PageViewPerformanceEnvelopeCreator, TraceEnvelopeCreator
@@ -129,7 +129,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
129
129
  let _retryAt: number; // The time to retry at in milliseconds from 1970/01/01 (this makes the timer calculation easy).
130
130
  let _lastSend: number; // The time of the last send operation.
131
131
  let _paused: boolean; // Flag indicating that the sending should be paused
132
- let _timeoutHandle: any; // Handle to the timer for delayed sending of batches of data.
132
+ let _timeoutHandle: ITimerHandler; // Handle to the timer for delayed sending of batches of data.
133
133
  let _serializer: Serializer;
134
134
  let _stamp_specific_redirects: number;
135
135
  let _headers: { [name: string]: string };
@@ -964,7 +964,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
964
964
  const retryInterval = _retryAt ? Math.max(0, _retryAt - dateNow()) : 0;
965
965
  const timerValue = Math.max(_maxBatchInterval, retryInterval);
966
966
 
967
- _timeoutHandle = setTimeout(() => {
967
+ _timeoutHandle = scheduleTimeout(() => {
968
968
  _timeoutHandle = null;
969
969
  _self.triggerSend(true, null, SendRequestReason.NormalSchedule);
970
970
  }, timerValue);
@@ -972,7 +972,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
972
972
  }
973
973
 
974
974
  function _clearScheduledTimer() {
975
- clearTimeout(_timeoutHandle);
975
+ _timeoutHandle && _timeoutHandle.cancel();
976
976
  _timeoutHandle = null;
977
977
  _retryAt = null;
978
978
  }