@microsoft/applicationinsights-web-basic 3.0.0-beta.2211-01 → 3.0.0-beta.2211-03

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.
@@ -3309,8 +3309,9 @@
3309
3309
  "text": "): "
3310
3310
  },
3311
3311
  {
3312
- "kind": "Content",
3313
- "text": "number"
3312
+ "kind": "Reference",
3313
+ "text": "ITimerHandler",
3314
+ "canonicalReference": "@nevware21/ts-utils!ITimerHandler:interface"
3314
3315
  },
3315
3316
  {
3316
3317
  "kind": "Content",
@@ -5752,8 +5753,9 @@
5752
5753
  "text": "): "
5753
5754
  },
5754
5755
  {
5755
- "kind": "Content",
5756
- "text": "number"
5756
+ "kind": "Reference",
5757
+ "text": "ITimerHandler",
5758
+ "canonicalReference": "@nevware21/ts-utils!ITimerHandler:interface"
5757
5759
  },
5758
5760
  {
5759
5761
  "kind": "Content",
@@ -7,6 +7,7 @@
7
7
  import { arrForEach } from '@nevware21/ts-utils';
8
8
  import { EnumCls } from '@nevware21/ts-utils';
9
9
  import { isNullOrUndefined } from '@nevware21/ts-utils';
10
+ import { ITimerHandler } from '@nevware21/ts-utils';
10
11
  import { throwError } from '@nevware21/ts-utils';
11
12
 
12
13
  // @public (undocumented)
@@ -65,7 +66,7 @@ export class AppInsightsCore implements IAppInsightsCore {
65
66
  onCfgChange<T extends IConfiguration = IConfiguration>(handler: WatcherFunction<T>): IUnloadHook;
66
67
  readonly pluginVersionString: string;
67
68
  readonly pluginVersionStringArr: string[];
68
- pollInternalLogs(eventName?: string): number;
69
+ pollInternalLogs(eventName?: string): ITimerHandler;
69
70
  // (undocumented)
70
71
  protected releaseQueue(): void;
71
72
  removeNotificationListener(listener: INotificationListener): void;
@@ -327,7 +328,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
327
328
  readonly pluginVersionString: string;
328
329
  readonly pluginVersionStringArr: string[];
329
330
  // (undocumented)
330
- pollInternalLogs?(eventName?: string): number;
331
+ pollInternalLogs?(eventName?: string): ITimerHandler;
331
332
  removeNotificationListener?(listener: INotificationListener): void;
332
333
  setCookieMgr(cookieMgr: ICookieMgr): void;
333
334
  setTraceCtx(newTraceCtx: IDistributedTraceContext | null | undefined): void;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 3.0.0-beta.2211-01
2
+ * Microsoft.ApplicationInsights, 3.0.0-beta.2211-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -10,6 +10,7 @@ declare namespace ApplicationInsights {
10
10
  import { arrForEach } from '@nevware21/ts-utils';
11
11
  import { EnumCls } from '@nevware21/ts-utils';
12
12
  import { isNullOrUndefined } from '@nevware21/ts-utils';
13
+ import { ITimerHandler } from '@nevware21/ts-utils';
13
14
  import { throwError } from '@nevware21/ts-utils';
14
15
 
15
16
  class AppInsightsCore implements IAppInsightsCore {
@@ -65,7 +66,7 @@ declare namespace ApplicationInsights {
65
66
  /**
66
67
  * Periodically check logger.queue for
67
68
  */
68
- pollInternalLogs(eventName?: string): number;
69
+ pollInternalLogs(eventName?: string): ITimerHandler;
69
70
  /**
70
71
  * Periodically check logger.queue for
71
72
  */
@@ -497,7 +498,7 @@ declare namespace ApplicationInsights {
497
498
  * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
498
499
  */
499
500
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
500
- pollInternalLogs?(eventName?: string): number;
501
+ pollInternalLogs?(eventName?: string): ITimerHandler;
501
502
  stopPollingInternalLogs?(): void;
502
503
  /**
503
504
  * Return a new instance of the IProcessTelemetryContext for processing events
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript Web SDK - Basic, 3.0.0-beta.2211-01
2
+ * Application Insights JavaScript Web SDK - Basic, 3.0.0-beta.2211-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -1080,6 +1080,22 @@
1080
1080
  return _scheduleTimeoutWith(this, setTimeout, clearTimeout, _extractArgs(arguments, 0));
1081
1081
  }
1082
1082
 
1083
+ function scheduleInterval(callback, timeout) {
1084
+ var self = this;
1085
+ var theArguments = arguments;
1086
+ var intervalId = setInterval.apply(self, theArguments);
1087
+ return {
1088
+ cancel: function () {
1089
+ clearInterval(intervalId);
1090
+ },
1091
+ refresh: function () {
1092
+ clearInterval(intervalId);
1093
+ intervalId = setInterval.apply(self, theArguments);
1094
+ return this;
1095
+ }
1096
+ };
1097
+ }
1098
+
1083
1099
  var createEnumStyle = createEnum;
1084
1100
  var createValueMap = createTypeMap;
1085
1101
 
@@ -1094,9 +1110,11 @@
1094
1110
  var _DYN_APPLY = "apply";
1095
1111
  var _DYN_PUSH$1 = "push";
1096
1112
  var _DYN_SPLICE = "splice";
1097
- var _DYN_INITIALIZE$1 = "initialize";
1113
+ var _DYN_CANCEL = "cancel";
1114
+ var _DYN_INITIALIZE = "initialize";
1098
1115
  var _DYN_IDENTIFIER = "identifier";
1099
1116
  var _DYN_IS_INITIALIZED = "isInitialized";
1117
+ var _DYN_POLL_INTERNAL_LOGS = "pollInternalLogs";
1100
1118
  var _DYN_NAME$2 = "name";
1101
1119
  var _DYN_TIME = "time";
1102
1120
  var _DYN_PROCESS_NEXT = "processNext";
@@ -1547,7 +1565,7 @@
1547
1565
  }
1548
1566
 
1549
1567
  var _objDefineProperty = ObjDefineProperty;
1550
- var version = "3.0.0-beta.2211-01";
1568
+ var version = "3.0.0-beta.2211-03";
1551
1569
  var instanceName = "." + newId(6);
1552
1570
  var _dataUid = 0;
1553
1571
  function _createAccessor(target, prop, value) {
@@ -1881,7 +1899,7 @@
1881
1899
  if (_waitingHandlers) {
1882
1900
  var notifyHandlers = _waitingHandlers;
1883
1901
  _waitingHandlers = null;
1884
- _watcherTimer && _watcherTimer.cancel();
1902
+ _watcherTimer && _watcherTimer[_DYN_CANCEL ]();
1885
1903
  _watcherTimer = null;
1886
1904
  var watcherFailures_1 = [];
1887
1905
  arrForEach(notifyHandlers, function (handler) {
@@ -2444,7 +2462,7 @@
2444
2462
  }
2445
2463
  arrForEach(initPlugins, function (thePlugin) {
2446
2464
  var core = processContext[STR_CORE ]();
2447
- thePlugin[_DYN_INITIALIZE$1 ](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT ]());
2465
+ thePlugin[_DYN_INITIALIZE ](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT ]());
2448
2466
  pluginState = _getPluginState(thePlugin);
2449
2467
  if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {
2450
2468
  pluginState[STR_CORE] = core;
@@ -3005,7 +3023,7 @@
3005
3023
  function doCallback() {
3006
3024
  waiting--;
3007
3025
  if (doneIterating && waiting === 0) {
3008
- cbTimer && cbTimer.cancel();
3026
+ cbTimer && cbTimer[_DYN_CANCEL ]();
3009
3027
  cbTimer = null;
3010
3028
  callBack && callBack(doneIterating);
3011
3029
  callBack = null;
@@ -3426,7 +3444,7 @@
3426
3444
  var _hooks;
3427
3445
  _initDefaults();
3428
3446
  dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
3429
- _self[_DYN_INITIALIZE$1 ] = function (config, core, extensions, pluginChain) {
3447
+ _self[_DYN_INITIALIZE ] = function (config, core, extensions, pluginChain) {
3430
3448
  _setDefaults(config, core, pluginChain);
3431
3449
  _isinitialized = true;
3432
3450
  };
@@ -3650,7 +3668,7 @@
3650
3668
  var coreExtensions = [];
3651
3669
  var extPriorities = {};
3652
3670
  arrForEach(allExtensions, function (ext) {
3653
- if (isNullOrUndefined(ext) || isNullOrUndefined(ext[_DYN_INITIALIZE$1 ])) {
3671
+ if (isNullOrUndefined(ext) || isNullOrUndefined(ext[_DYN_INITIALIZE ])) {
3654
3672
  throwError(strValidationError);
3655
3673
  }
3656
3674
  var extPriority = ext[STR_PRIORITY ];
@@ -3765,14 +3783,15 @@
3765
3783
  var _extensions;
3766
3784
  var _pluginVersionStringArr;
3767
3785
  var _pluginVersionString;
3768
- var _internalLogPoller = 0;
3786
+ var _internalLogPoller;
3787
+ var _internalLogPollerListening;
3769
3788
  dynamicProto(AppInsightsCore, this, function (_self) {
3770
3789
  _initDefaults();
3771
3790
  _self["_getDbgPlgTargets"] = function () {
3772
3791
  return [_extensions];
3773
3792
  };
3774
3793
  _self[_DYN_IS_INITIALIZED ] = function () { return _isInitialized; };
3775
- _self[_DYN_INITIALIZE$1 ] = function (config, extensions, logger, notificationManager) {
3794
+ _self[_DYN_INITIALIZE ] = function (config, extensions, logger, notificationManager) {
3776
3795
  if (_isUnloading) {
3777
3796
  throwError(strSdkUnloadingError);
3778
3797
  }
@@ -3804,6 +3823,7 @@
3804
3823
  _cfgListeners = null;
3805
3824
  _isInitialized = true;
3806
3825
  _self.releaseQueue();
3826
+ _self[_DYN_POLL_INTERNAL_LOGS ]();
3807
3827
  };
3808
3828
  _self.getTransmissionControls = function () {
3809
3829
  var controls = [];
@@ -3892,26 +3912,33 @@
3892
3912
  });
3893
3913
  }
3894
3914
  };
3895
- _self.pollInternalLogs = function (eventName) {
3915
+ _self[_DYN_POLL_INTERNAL_LOGS ] = function (eventName) {
3896
3916
  _internalLogsEventName = eventName || null;
3897
- _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
3898
- var interval = details.cfg.diagnosticLogInterval;
3917
+ function _startLogPoller(config) {
3918
+ var interval = config.diagnosticLogInterval;
3899
3919
  if (!interval || !(interval > 0)) {
3900
3920
  interval = 10000;
3901
3921
  }
3902
- if (_internalLogPoller) {
3903
- clearInterval(_internalLogPoller);
3904
- }
3905
- _internalLogPoller = setInterval(function () {
3922
+ _internalLogPoller && _internalLogPoller[_DYN_CANCEL ]();
3923
+ _internalLogPoller = scheduleInterval(function () {
3906
3924
  _flushInternalLogs();
3907
3925
  }, interval);
3908
- }));
3926
+ }
3927
+ if (!_internalLogPollerListening) {
3928
+ _internalLogPollerListening = true;
3929
+ _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
3930
+ _startLogPoller(details.cfg);
3931
+ }));
3932
+ }
3933
+ else {
3934
+ _startLogPoller(_configHandler.cfg);
3935
+ }
3909
3936
  return _internalLogPoller;
3910
3937
  };
3911
3938
  _self[_DYN_STOP_POLLING_INTERNA3 ] = function () {
3912
3939
  if (_internalLogPoller) {
3913
- clearInterval(_internalLogPoller);
3914
- _internalLogPoller = 0;
3940
+ _internalLogPoller[_DYN_CANCEL ]();
3941
+ _internalLogPoller = null;
3915
3942
  _flushInternalLogs();
3916
3943
  }
3917
3944
  };
@@ -4177,7 +4204,7 @@
4177
4204
  allExtensions[_DYN_PUSH$1 ](_channelControl);
4178
4205
  _coreExtensions[_DYN_PUSH$1 ](_channelControl);
4179
4206
  _extensions = sortPlugins(allExtensions);
4180
- _channelControl[_DYN_INITIALIZE$1 ](_configHandler.cfg, _self, allExtensions);
4207
+ _channelControl[_DYN_INITIALIZE ](_configHandler.cfg, _self, allExtensions);
4181
4208
  initializePlugins(_createTelCtx(), allExtensions);
4182
4209
  _extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
4183
4210
  if (updateState) {
@@ -5825,7 +5852,7 @@
5825
5852
  }
5826
5853
  }
5827
5854
  var EnvelopeCreator = {
5828
- Version: "3.0.0-beta.2211-01"
5855
+ Version: "3.0.0-beta.2211-03"
5829
5856
  };
5830
5857
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
5831
5858
  EnvelopeCreatorInit(logger, telemetryItem);
@@ -7213,7 +7240,6 @@
7213
7240
  return Sender;
7214
7241
  }(BaseTelemetryPlugin));
7215
7242
 
7216
- var _DYN_INITIALIZE = "initialize";
7217
7243
  var _DYN_DIAGNOSTIC_LOG_INTER0 = "diagnosticLogInterval";
7218
7244
 
7219
7245
  var ApplicationInsights = /** @class */ (function () {
@@ -7230,7 +7256,7 @@
7230
7256
  get: function () { return config; }
7231
7257
  });
7232
7258
  _initialize();
7233
- _self[_DYN_INITIALIZE ] = _initialize;
7259
+ _self.initialize = _initialize;
7234
7260
  _self.getSKUDefaults = function () {
7235
7261
  _self.config[_DYN_DIAGNOSTIC_LOG_INTER0 ] =
7236
7262
  _self.config[_DYN_DIAGNOSTIC_LOG_INTER0 ] && _self.config[_DYN_DIAGNOSTIC_LOG_INTER0 ] > 0 ? _self.config[_DYN_DIAGNOSTIC_LOG_INTER0 ] : 10000;
@@ -7248,12 +7274,7 @@
7248
7274
  "addUnloadCb"
7249
7275
  ]);
7250
7276
  function _initialize() {
7251
- var extensions = [];
7252
- var appInsightsChannel = new Sender();
7253
- extensions.push(appInsightsChannel);
7254
- core[_DYN_INITIALIZE ](_self.config, extensions);
7255
- appInsightsChannel[_DYN_INITIALIZE ](_self.config, core, extensions);
7256
- core.pollInternalLogs();
7277
+ core.initialize(_self.config, [new Sender()]);
7257
7278
  }
7258
7279
  });
7259
7280
  }