@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-04
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/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +1999 -793
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +16363 -9167
- package/dist/applicationinsights-core-js.api.md +425 -48
- package/dist/applicationinsights-core-js.d.ts +784 -123
- package/dist/applicationinsights-core-js.js +1999 -793
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +784 -123
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +3 -69
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +496 -99
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +120 -21
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +202 -87
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +7 -148
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +25 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +13 -12
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +477 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +89 -86
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/NotificationManager.js +37 -42
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +430 -119
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +30 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +60 -14
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +81 -0
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +12 -7
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +2 -101
- package/src/JavaScriptSDK/BaseCore.ts +696 -120
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +205 -31
- package/src/JavaScriptSDK/ChannelController.ts +242 -103
- package/src/JavaScriptSDK/CookieMgr.ts +7 -5
- package/src/JavaScriptSDK/CoreUtils.ts +8 -172
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +27 -12
- package/src/JavaScriptSDK/EnvUtils.ts +13 -12
- package/src/JavaScriptSDK/EventHelpers.ts +550 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +123 -97
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -2
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +34 -37
- package/src/JavaScriptSDK/PerfManager.ts +4 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +543 -134
- package/src/JavaScriptSDK/RandomHelper.ts +35 -3
- package/src/JavaScriptSDK/TelemetryHelpers.ts +83 -21
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +111 -0
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +184 -87
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +82 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +16 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +16 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +94 -14
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +28 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
- package/types/JavaScriptSDK/BaseCore.d.ts +81 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +53 -10
- package/types/JavaScriptSDK/ChannelController.d.ts +16 -17
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -48
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +10 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +33 -32
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +69 -6
- package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +23 -3
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +16 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +91 -2
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +72 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +16 -5
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +82 -11
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +25 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
- package/types/applicationinsights-core-js.d.ts +18 -9
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
|
@@ -4,15 +4,11 @@ import {
|
|
|
4
4
|
strShimUndefined, strShimObject, strShimFunction, throwTypeError,
|
|
5
5
|
ObjClass, ObjProto, ObjAssign, ObjHasOwnProperty, ObjDefineProperty, strShimPrototype
|
|
6
6
|
} from "@microsoft/applicationinsights-shims";
|
|
7
|
+
import { strEmpty } from "./InternalConstants";
|
|
7
8
|
|
|
8
9
|
// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly
|
|
9
10
|
|
|
10
11
|
// Added to help with minfication
|
|
11
|
-
const strOnPrefix = "on";
|
|
12
|
-
const strAttachEvent = "attachEvent";
|
|
13
|
-
const strAddEventHelper = "addEventListener";
|
|
14
|
-
const strDetachEvent = "detachEvent";
|
|
15
|
-
const strRemoveEventListener = "removeEventListener";
|
|
16
12
|
const strToISOString = "toISOString";
|
|
17
13
|
const cStrEndsWith = "endsWith";
|
|
18
14
|
const cStrStartsWith = "startsWith";
|
|
@@ -26,9 +22,9 @@ const strToString = "toString";
|
|
|
26
22
|
* Constant string defined to support minimization
|
|
27
23
|
* @ignore
|
|
28
24
|
*/
|
|
29
|
-
|
|
25
|
+
const str__Proto = "__proto__";
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
/**
|
|
32
28
|
* Constant string defined to support minimization
|
|
33
29
|
* @ignore
|
|
34
30
|
*/
|
|
@@ -62,27 +58,27 @@ const rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
|
62
58
|
* Pre-lookup to check if we are running on a modern browser (i.e. not IE8)
|
|
63
59
|
* @ignore
|
|
64
60
|
*/
|
|
65
|
-
|
|
61
|
+
let _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
/**
|
|
68
64
|
* Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.
|
|
69
65
|
* @ignore
|
|
70
66
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
export function _getObjProto(target:any) {
|
|
68
|
+
if (target) {
|
|
69
|
+
// This method doesn't existing in older browsers (e.g. IE8)
|
|
70
|
+
if (_objGetPrototypeOf) {
|
|
71
|
+
return _objGetPrototypeOf(target);
|
|
72
|
+
}
|
|
77
73
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
// target[Constructor] May break if the constructor has been changed or removed
|
|
75
|
+
let newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
76
|
+
if(newProto) {
|
|
77
|
+
return newProto;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
84
80
|
|
|
85
|
-
|
|
81
|
+
return null;
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
export function objToString(obj: any) {
|
|
@@ -93,19 +89,19 @@ export function isTypeof(value: any, theType: string): boolean {
|
|
|
93
89
|
return typeof value === theType;
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
export function isUndefined(value: any):
|
|
92
|
+
export function isUndefined(value: any): value is undefined {
|
|
97
93
|
return value === undefined || typeof value === strShimUndefined;
|
|
98
94
|
}
|
|
99
95
|
|
|
100
|
-
export function isNotUndefined(value:
|
|
96
|
+
export function isNotUndefined<T>(value: T): value is T {
|
|
101
97
|
return !isUndefined(value);
|
|
102
98
|
}
|
|
103
99
|
|
|
104
|
-
export function isNullOrUndefined(value: any):
|
|
100
|
+
export function isNullOrUndefined(value: any): value is null | undefined {
|
|
105
101
|
return (value === null || isUndefined(value));
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
export function isNotNullOrUndefined(value:
|
|
104
|
+
export function isNotNullOrUndefined<T>(value: T): value is T {
|
|
109
105
|
return !isNullOrUndefined(value);
|
|
110
106
|
}
|
|
111
107
|
|
|
@@ -113,7 +109,7 @@ export function hasOwnProperty(obj: any, prop: string): boolean {
|
|
|
113
109
|
return !!(obj && ObjHasOwnProperty.call(obj, prop));
|
|
114
110
|
}
|
|
115
111
|
|
|
116
|
-
export function isObject(value:
|
|
112
|
+
export function isObject<T>(value: T): value is T {
|
|
117
113
|
// Changing to inline for performance
|
|
118
114
|
return !!(value && typeof value === strShimObject);
|
|
119
115
|
}
|
|
@@ -123,54 +119,8 @@ export function isFunction(value: any): value is Function {
|
|
|
123
119
|
return !!(value && typeof value === strShimFunction);
|
|
124
120
|
}
|
|
125
121
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
* @param obj Object to add the event too.
|
|
129
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
130
|
-
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
131
|
-
* @param useCapture [Optional] Defaults to false
|
|
132
|
-
* @returns True if the function was bound successfully to the event, otherwise false
|
|
133
|
-
*/
|
|
134
|
-
export function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture: boolean = false) {
|
|
135
|
-
let result = false;
|
|
136
|
-
if (!isNullOrUndefined(obj)) {
|
|
137
|
-
try {
|
|
138
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
139
|
-
// all browsers except IE before version 9
|
|
140
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
141
|
-
result = true;
|
|
142
|
-
} else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
143
|
-
// IE before version 9
|
|
144
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
145
|
-
result = true;
|
|
146
|
-
}
|
|
147
|
-
} catch (e) {
|
|
148
|
-
// Just Ignore any error so that we don't break any execution path
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return result;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Removes an event handler for the specified event
|
|
157
|
-
* @param Object to remove the event from
|
|
158
|
-
* @param eventNameWithoutOn {string} - The name of the event
|
|
159
|
-
* @param handlerRef {any} - The callback function that needs to be executed for the given event
|
|
160
|
-
* @param useCapture [Optional] Defaults to false
|
|
161
|
-
*/
|
|
162
|
-
export function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture: boolean = false) {
|
|
163
|
-
if (!isNullOrUndefined(obj)) {
|
|
164
|
-
try {
|
|
165
|
-
if (!isNullOrUndefined(obj[strRemoveEventListener])) {
|
|
166
|
-
obj[strRemoveEventListener](eventNameWithoutOn, handlerRef, useCapture);
|
|
167
|
-
} else if (!isNullOrUndefined(obj[strDetachEvent])) {
|
|
168
|
-
obj[strDetachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
169
|
-
}
|
|
170
|
-
} catch (e) {
|
|
171
|
-
// Just Ignore any error so that we don't break any execution path
|
|
172
|
-
}
|
|
173
|
-
}
|
|
122
|
+
export function isPromiseLike<T>(value: any): value is PromiseLike<T> {
|
|
123
|
+
return value && isFunction(value.then);
|
|
174
124
|
}
|
|
175
125
|
|
|
176
126
|
/**
|
|
@@ -204,7 +154,7 @@ export function normalizeJsName(name: string): string {
|
|
|
204
154
|
* @param target The target object to find and process the keys
|
|
205
155
|
* @param callbackfn The function to call with the details
|
|
206
156
|
*/
|
|
207
|
-
export function objForEachKey(target:
|
|
157
|
+
export function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void) {
|
|
208
158
|
if (target) {
|
|
209
159
|
for (let prop in target) {
|
|
210
160
|
if (ObjHasOwnProperty.call(target, prop)) {
|
|
@@ -236,7 +186,7 @@ export function strEndsWith(value: string, search: string) {
|
|
|
236
186
|
* @param search - The characters to be searched for at the end of the value.
|
|
237
187
|
* @returns true if the given search value is found at the end of the string, otherwise false.
|
|
238
188
|
*/
|
|
239
|
-
|
|
189
|
+
export function _strEndsWithPoly(value: string, search: string) {
|
|
240
190
|
let result = false;
|
|
241
191
|
let searchLen = search ? search.length : 0;
|
|
242
192
|
let valLen = value ? value.length : 0;
|
|
@@ -264,7 +214,7 @@ export function strEndsWith(value: string, search: string) {
|
|
|
264
214
|
export function strStartsWith(value: string, checkValue: string) {
|
|
265
215
|
let result = false;
|
|
266
216
|
if (value && checkValue && !(result = value === checkValue)) {
|
|
267
|
-
|
|
217
|
+
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
268
218
|
result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);
|
|
269
219
|
}
|
|
270
220
|
|
|
@@ -277,7 +227,7 @@ export function strStartsWith(value: string, checkValue: string) {
|
|
|
277
227
|
* @param checkValue - The characters to be searched for at the start of the value.
|
|
278
228
|
* @returns true if the given search value is found at the start of the string, otherwise false.
|
|
279
229
|
*/
|
|
280
|
-
|
|
230
|
+
export function _strStartsWithPoly(value: string, checkValue: string) {
|
|
281
231
|
// Using helper for performance and because string startsWith() is not available on IE
|
|
282
232
|
let result = false;
|
|
283
233
|
let chkLen = checkValue ? checkValue.length : 0;
|
|
@@ -315,7 +265,8 @@ export function isDate(obj: any): obj is Date {
|
|
|
315
265
|
}
|
|
316
266
|
|
|
317
267
|
/**
|
|
318
|
-
* Check if an object is of type Array
|
|
268
|
+
* Check if an object is of type Array with optional generic T, the generic type is not validated
|
|
269
|
+
* and exists to help with TypeScript validation only.
|
|
319
270
|
*/
|
|
320
271
|
export let isArray: <T = any>(obj: any) => obj is Array<T> = _isArray || _isArrayPoly;
|
|
321
272
|
function _isArrayPoly<T = any>(obj: any): obj is Array<T> {
|
|
@@ -377,7 +328,7 @@ export function isPlainObject(value: any): boolean {
|
|
|
377
328
|
let result: boolean = false;
|
|
378
329
|
|
|
379
330
|
if (value && typeof value === "object") {
|
|
380
|
-
|
|
331
|
+
// Inlining _objGetPrototypeOf for performance to avoid an additional function call
|
|
381
332
|
let proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
382
333
|
if (!proto) {
|
|
383
334
|
// No prototype found so this is a plain Object eg. 'Object.create(null)'
|
|
@@ -438,7 +389,7 @@ export function _toISOStringPoly(date: Date) {
|
|
|
438
389
|
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
|
|
439
390
|
* @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
|
440
391
|
*/
|
|
441
|
-
export function arrForEach<T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void|number, thisArg?: any): void {
|
|
392
|
+
export function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void {
|
|
442
393
|
let len = arr.length;
|
|
443
394
|
try {
|
|
444
395
|
for (let idx = 0; idx < len; idx++) {
|
|
@@ -664,6 +615,18 @@ function _doNothing<T>(value: T): T {
|
|
|
664
615
|
return value;
|
|
665
616
|
}
|
|
666
617
|
|
|
618
|
+
export function deepFreeze<T>(obj: T): T {
|
|
619
|
+
if (_objFreeze) {
|
|
620
|
+
objForEachKey(obj, (name, value) => {
|
|
621
|
+
if (isArray(value) || isObject(value)) {
|
|
622
|
+
_objFreeze(value);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return objFreeze(obj);
|
|
628
|
+
}
|
|
629
|
+
|
|
667
630
|
export const objFreeze: <T>(value: T) => T = _objFreeze || _doNothing;
|
|
668
631
|
export const objSeal: <T>(value: T) => T = _objSeal || _doNothing;
|
|
669
632
|
|
|
@@ -685,7 +648,7 @@ export function getExceptionName(object: any): string {
|
|
|
685
648
|
return object.name;
|
|
686
649
|
}
|
|
687
650
|
|
|
688
|
-
return
|
|
651
|
+
return strEmpty;
|
|
689
652
|
}
|
|
690
653
|
|
|
691
654
|
/**
|
|
@@ -698,7 +661,7 @@ export function getExceptionName(object: any): string {
|
|
|
698
661
|
* @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)
|
|
699
662
|
* @returns The existing or new value, depending what was set
|
|
700
663
|
*/
|
|
701
|
-
export function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean) {
|
|
664
|
+
export function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: ((value: T[K]) => boolean) | null, srcChk?: ((value: T[K]) => boolean) | null) {
|
|
702
665
|
let theValue = value;
|
|
703
666
|
if (target) {
|
|
704
667
|
theValue = target[field];
|
|
@@ -746,6 +709,28 @@ export function throwError(message: string): never {
|
|
|
746
709
|
throw new Error(message);
|
|
747
710
|
}
|
|
748
711
|
|
|
712
|
+
function _createProxyFunction<S>(source: S | (() => S), funcName: (keyof S)) {
|
|
713
|
+
let srcFunc: () => S = null;
|
|
714
|
+
let src: S = null;
|
|
715
|
+
if (isFunction (source)) {
|
|
716
|
+
srcFunc = source;
|
|
717
|
+
} else {
|
|
718
|
+
src = source;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
return function() {
|
|
722
|
+
// Capture the original arguments passed to the method
|
|
723
|
+
var originalArguments = arguments;
|
|
724
|
+
if (srcFunc) {
|
|
725
|
+
src = srcFunc();
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
if (src) {
|
|
729
|
+
return (src[funcName] as any).apply(src, originalArguments);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
749
734
|
/**
|
|
750
735
|
* Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from
|
|
751
736
|
* the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential
|
|
@@ -760,10 +745,9 @@ export function throwError(message: string): never {
|
|
|
760
745
|
* @param target - The target object to be assigned with the source properties and functions
|
|
761
746
|
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
762
747
|
* @param chkSet - An optional callback to determine whether a specific property/function should be proxied
|
|
763
|
-
* @memberof Initialization
|
|
764
748
|
*/
|
|
765
|
-
export function proxyAssign(target:
|
|
766
|
-
if (target && source &&
|
|
749
|
+
export function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean) {
|
|
750
|
+
if (target && source && isObject(target) && isObject(source)) {
|
|
767
751
|
// effectively apply/proxy full source to the target instance
|
|
768
752
|
for (const field in source) {
|
|
769
753
|
if (isString(field)) {
|
|
@@ -771,18 +755,12 @@ export function proxyAssign(target: any, source: any, chkSet?: (name: string, is
|
|
|
771
755
|
if (isFunction(value)) {
|
|
772
756
|
if (!chkSet || chkSet(field, true, source, target)) {
|
|
773
757
|
// Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function
|
|
774
|
-
target[field as string] = (
|
|
775
|
-
return function() {
|
|
776
|
-
// Capture the original arguments passed to the method
|
|
777
|
-
var originalArguments = arguments;
|
|
778
|
-
return source[funcName].apply(source, originalArguments);
|
|
779
|
-
}
|
|
780
|
-
})(field);
|
|
758
|
+
target[field as string] = _createProxyFunction(source, field);
|
|
781
759
|
}
|
|
782
760
|
} else if (!chkSet || chkSet(field, false, source, target)) {
|
|
783
761
|
if (hasOwnProperty(target, field)) {
|
|
784
762
|
// Remove any previous instance property
|
|
785
|
-
delete target[field];
|
|
763
|
+
delete (target as any)[field];
|
|
786
764
|
}
|
|
787
765
|
|
|
788
766
|
if (!objDefineAccessors(target, field, () => {
|
|
@@ -803,6 +781,33 @@ export function proxyAssign(target: any, source: any, chkSet?: (name: string, is
|
|
|
803
781
|
return target;
|
|
804
782
|
}
|
|
805
783
|
|
|
784
|
+
export function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget: boolean = true) {
|
|
785
|
+
if (target && name && source) {
|
|
786
|
+
if (overwriteTarget || isUndefined(target[name])) {
|
|
787
|
+
(target as any)[name] = _createProxyFunction(source, theFunc);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
|
|
794
|
+
*
|
|
795
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
796
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
797
|
+
* @param functionsToProxy - An array of function names that will be proxied on the target
|
|
798
|
+
*/
|
|
799
|
+
export function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget: boolean = true) {
|
|
800
|
+
if (target && source && isObject(target) && isArray(functionsToProxy)) {
|
|
801
|
+
arrForEach(functionsToProxy, (theFuncName) => {
|
|
802
|
+
if (isString(theFuncName)) {
|
|
803
|
+
proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
return target;
|
|
809
|
+
}
|
|
810
|
+
|
|
806
811
|
/**
|
|
807
812
|
* Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.
|
|
808
813
|
* Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance
|
|
@@ -820,6 +825,25 @@ export function createClassFromInterface<T>(defaults?: T) {
|
|
|
820
825
|
} as new () => T;
|
|
821
826
|
}
|
|
822
827
|
|
|
828
|
+
/**
|
|
829
|
+
* Create an enum style object which has both the key => value and value => key mappings
|
|
830
|
+
* @param values - The values to populate on the new object
|
|
831
|
+
* @returns
|
|
832
|
+
*/
|
|
833
|
+
export function createEnumStyle<T>(values: T) {
|
|
834
|
+
let enumClass: any = {};
|
|
835
|
+
objForEachKey(values, (field, value) => {
|
|
836
|
+
enumClass[field] = value;
|
|
837
|
+
// Add Reverse lookup
|
|
838
|
+
if (!isUndefined(enumClass[value])) {
|
|
839
|
+
throwError("[" + value + "] exists for " + field);
|
|
840
|
+
}
|
|
841
|
+
enumClass[value] = field;
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
return objFreeze(enumClass as T);
|
|
845
|
+
}
|
|
846
|
+
|
|
823
847
|
/**
|
|
824
848
|
* A helper function to assist with JIT performance for objects that have properties added / removed dynamically
|
|
825
849
|
* this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this
|
|
@@ -847,7 +871,9 @@ export function optimizeObject<T>(theObject: T): T {
|
|
|
847
871
|
* @param obj5 - object to merge.
|
|
848
872
|
* @returns The extended first object.
|
|
849
873
|
*/
|
|
850
|
-
|
|
874
|
+
export function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6
|
|
875
|
+
export function objExtend<T1, T2, T3, T4, T5, T6>(obj1?: T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6
|
|
876
|
+
export function objExtend<T1, T2, T3, T4, T5, T6>(obj1?: T1 | any, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6 {
|
|
851
877
|
// Variables
|
|
852
878
|
let theArgs = arguments as any;
|
|
853
879
|
let extended: T1 & T2 & T3 & T4 & T5 & T6 = theArgs[0] || {};
|
|
@@ -862,7 +888,7 @@ export function optimizeObject<T>(theObject: T): T {
|
|
|
862
888
|
idx++;
|
|
863
889
|
}
|
|
864
890
|
|
|
865
|
-
|
|
891
|
+
// Handle case when target is a string or something (possible in deep copy)
|
|
866
892
|
if (!isObject(extended)) {
|
|
867
893
|
extended = {} as T1 & T2 & T3 & T4 & T5 & T6;
|
|
868
894
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "../JavaScriptSDK.Interfaces/IInstrumentHooks";
|
|
7
7
|
import { strShimFunction, strShimPrototype } from "@microsoft/applicationinsights-shims";
|
|
8
8
|
import { hasOwnProperty, _getObjProto } from "./HelperFuncs";
|
|
9
|
+
import { getGlobalInst } from "./EnvUtils";
|
|
9
10
|
|
|
10
11
|
const aiInstrumentHooks = "_aiHooks";
|
|
11
12
|
|
|
@@ -72,13 +73,13 @@ function _doCallbacks(hooks:IInstrumentHook[], callDetails: IInstrumentCallDetai
|
|
|
72
73
|
function _createFunctionHook(aiHook:IInstrumentHooks) {
|
|
73
74
|
|
|
74
75
|
// Define a temporary method that queues-up a the real method call
|
|
75
|
-
return function () {
|
|
76
|
+
return function (this: any) {
|
|
76
77
|
let funcThis = this;
|
|
77
78
|
// Capture the original arguments passed to the method
|
|
78
79
|
let orgArgs = arguments as any;
|
|
79
80
|
let hooks = aiHook.h;
|
|
80
81
|
|
|
81
|
-
let funcArgs:IInstrumentCallDetails = {
|
|
82
|
+
let funcArgs: IInstrumentCallDetails = {
|
|
82
83
|
name: aiHook.n,
|
|
83
84
|
inst: funcThis,
|
|
84
85
|
ctx: null,
|
|
@@ -87,6 +88,7 @@ function _createFunctionHook(aiHook:IInstrumentHooks) {
|
|
|
87
88
|
|
|
88
89
|
let hookCtx: any[] = [];
|
|
89
90
|
let cbArgs = _createArgs([funcArgs], orgArgs);
|
|
91
|
+
funcArgs.evt = getGlobalInst("event");
|
|
90
92
|
|
|
91
93
|
function _createArgs(target:any[], theArgs:any[]): any[] {
|
|
92
94
|
_arrLoop((theArgs as any), (arg) => {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
|
|
5
|
+
|
|
6
|
+
export const strEmpty = "";
|
|
7
|
+
export const strProcessTelemetry = "processTelemetry";
|
|
8
|
+
export const strPriority = "priority";
|
|
9
|
+
export const strSetNextPlugin = "setNextPlugin";
|
|
10
|
+
export const strIsInitialized = "isInitialized";
|
|
11
|
+
export const strTeardown = "teardown";
|
|
12
|
+
export const strCore = "core";
|
|
13
|
+
export const strUpdate = "update";
|
|
14
|
+
export const strDisabled = "disabled";
|
|
15
|
+
export const strDoTeardown = "_doTeardown";
|
|
16
|
+
export const strProcessNext = "processNext";
|
|
17
|
+
export const strResume = "resume";
|
|
18
|
+
export const strPause = "pause";
|
|
19
|
+
export const strNotificationListener = "NotificationListener";
|
|
20
|
+
export const strAddNotificationListener = "add" + strNotificationListener;
|
|
21
|
+
export const strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
22
|
+
|
|
23
|
+
export const strEventsSent = "eventsSent";
|
|
24
|
+
export const strEventsDiscarded = "eventsDiscarded";
|
|
25
|
+
export const strEventsSendRequest = "eventsSendRequest";
|
|
26
|
+
export const strPerfEvent = "perfEvent";
|
|
@@ -7,6 +7,23 @@ import { INotificationManager } from "../JavaScriptSDK.Interfaces/INotificationM
|
|
|
7
7
|
import { IPerfEvent } from "../JavaScriptSDK.Interfaces/IPerfEvent";
|
|
8
8
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
9
9
|
import { arrForEach, arrIndexOf } from "./HelperFuncs";
|
|
10
|
+
import { strAddNotificationListener, strEventsDiscarded, strEventsSendRequest, strEventsSent, strPerfEvent, strRemoveNotificationListener } from "./InternalConstants";
|
|
11
|
+
|
|
12
|
+
function _runListeners(listeners: INotificationListener[], name: string, isAsync: boolean, callback: (listener: INotificationListener) => void) {
|
|
13
|
+
arrForEach(listeners, (listener) => {
|
|
14
|
+
if (listener && listener[name]) {
|
|
15
|
+
if (isAsync) {
|
|
16
|
+
setTimeout(() => callback(listener), 0);
|
|
17
|
+
} else {
|
|
18
|
+
try {
|
|
19
|
+
callback(listener);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
// Catch errors to ensure we don't block sending the requests
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
10
27
|
|
|
11
28
|
/**
|
|
12
29
|
* Class to manage sending notifications to all the listeners.
|
|
@@ -18,7 +35,7 @@ export class NotificationManager implements INotificationManager {
|
|
|
18
35
|
let perfEvtsSendAll = !!(config ||{}).perfEvtsSendAll;
|
|
19
36
|
|
|
20
37
|
dynamicProto(NotificationManager, this, (_self) => {
|
|
21
|
-
_self
|
|
38
|
+
_self[strAddNotificationListener] = (listener: INotificationListener): void => {
|
|
22
39
|
_self.listeners.push(listener);
|
|
23
40
|
};
|
|
24
41
|
|
|
@@ -26,7 +43,7 @@ export class NotificationManager implements INotificationManager {
|
|
|
26
43
|
* Removes all instances of the listener.
|
|
27
44
|
* @param {INotificationListener} listener - AWTNotificationListener to remove.
|
|
28
45
|
*/
|
|
29
|
-
_self
|
|
46
|
+
_self[strRemoveNotificationListener] = (listener: INotificationListener): void => {
|
|
30
47
|
let index: number = arrIndexOf(_self.listeners, listener);
|
|
31
48
|
while (index > -1) {
|
|
32
49
|
_self.listeners.splice(index, 1);
|
|
@@ -38,11 +55,9 @@ export class NotificationManager implements INotificationManager {
|
|
|
38
55
|
* Notification for events sent.
|
|
39
56
|
* @param {ITelemetryItem[]} events - The array of events that have been sent.
|
|
40
57
|
*/
|
|
41
|
-
_self
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setTimeout(() => listener.eventsSent(events), 0);
|
|
45
|
-
}
|
|
58
|
+
_self[strEventsSent] = (events: ITelemetryItem[]): void => {
|
|
59
|
+
_runListeners(_self.listeners, strEventsSent, true, (listener) => {
|
|
60
|
+
listener[strEventsSent](events);
|
|
46
61
|
});
|
|
47
62
|
};
|
|
48
63
|
|
|
@@ -52,11 +67,9 @@ export class NotificationManager implements INotificationManager {
|
|
|
52
67
|
* @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason
|
|
53
68
|
* constant should be used to check the different values.
|
|
54
69
|
*/
|
|
55
|
-
_self
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
setTimeout(() => listener.eventsDiscarded(events, reason), 0);
|
|
59
|
-
}
|
|
70
|
+
_self[strEventsDiscarded] = (events: ITelemetryItem[], reason: number): void => {
|
|
71
|
+
_runListeners(_self.listeners, strEventsDiscarded, true, (listener) => {
|
|
72
|
+
listener[strEventsDiscarded](events, reason);
|
|
60
73
|
});
|
|
61
74
|
};
|
|
62
75
|
|
|
@@ -65,38 +78,22 @@ export class NotificationManager implements INotificationManager {
|
|
|
65
78
|
* @param {number} sendReason - The reason why the event batch is being sent.
|
|
66
79
|
* @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.
|
|
67
80
|
*/
|
|
68
|
-
_self
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (isAsync) {
|
|
72
|
-
setTimeout(() => listener.eventsSendRequest(sendReason, isAsync), 0);
|
|
73
|
-
} else {
|
|
74
|
-
try {
|
|
75
|
-
listener.eventsSendRequest(sendReason, isAsync);
|
|
76
|
-
} catch (e) {
|
|
77
|
-
// Catch errors to ensure we don't block sending the requests
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
+
_self[strEventsSendRequest] = (sendReason: number, isAsync: boolean): void => {
|
|
82
|
+
_runListeners(_self.listeners, strEventsSendRequest, isAsync, (listener) => {
|
|
83
|
+
listener[strEventsSendRequest](sendReason, isAsync);
|
|
81
84
|
});
|
|
82
85
|
};
|
|
83
86
|
|
|
84
|
-
_self
|
|
87
|
+
_self[strPerfEvent] = (perfEvent?: IPerfEvent): void => {
|
|
85
88
|
if (perfEvent) {
|
|
86
89
|
|
|
87
90
|
// Send all events or only parent events
|
|
88
91
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
listener.perfEvent(perfEvent);
|
|
96
|
-
} catch (e) {
|
|
97
|
-
// Catch errors to ensure we don't block sending the requests
|
|
98
|
-
}
|
|
99
|
-
}
|
|
92
|
+
_runListeners(_self.listeners, strPerfEvent, false, (listener) => {
|
|
93
|
+
if (perfEvent.isAsync) {
|
|
94
|
+
setTimeout(() => listener[strPerfEvent](perfEvent), 0);
|
|
95
|
+
} else {
|
|
96
|
+
listener[strPerfEvent](perfEvent);
|
|
100
97
|
}
|
|
101
98
|
});
|
|
102
99
|
}
|
|
@@ -104,12 +104,9 @@ export class PerfEvent implements IPerfEvent {
|
|
|
104
104
|
_self.isChildEvt = (): boolean => true;
|
|
105
105
|
}
|
|
106
106
|
_self[key] = value;
|
|
107
|
-
}
|
|
108
|
-
else if (key === PerfEvent.ChildrenContextKey) {
|
|
107
|
+
} else if (key === PerfEvent.ChildrenContextKey) {
|
|
109
108
|
_self[key] = value;
|
|
110
|
-
}
|
|
111
|
-
else
|
|
112
|
-
{
|
|
109
|
+
} else {
|
|
113
110
|
let ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
114
111
|
ctx[key] = value;
|
|
115
112
|
}
|
|
@@ -119,7 +116,7 @@ export class PerfEvent implements IPerfEvent {
|
|
|
119
116
|
_self.complete = () => {
|
|
120
117
|
let childTime = 0;
|
|
121
118
|
let childEvts = _self.getCtx(PerfEvent.ChildrenContextKey);
|
|
122
|
-
if (isArray(childEvts)) {
|
|
119
|
+
if (isArray<IPerfEvent>(childEvts)) {
|
|
123
120
|
for (let lp = 0; lp < childEvts.length; lp++) {
|
|
124
121
|
let childEvt: IPerfEvent = childEvts[lp];
|
|
125
122
|
if (childEvt) {
|
|
@@ -146,7 +143,7 @@ export class PerfManager implements IPerfManager {
|
|
|
146
143
|
*/
|
|
147
144
|
private ctx: { [key: string] : any } = {};
|
|
148
145
|
|
|
149
|
-
constructor(manager
|
|
146
|
+
constructor(manager?: INotificationManager) {
|
|
150
147
|
|
|
151
148
|
dynamicProto(PerfManager, this, (_self) => {
|
|
152
149
|
|