@microsoft/applicationinsights-core-js 2.8.0 → 2.8.1
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 +53 -37
- 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 +95 -1
- package/dist/applicationinsights-core-js.api.md +4 -1
- package/dist/applicationinsights-core-js.d.ts +12 -2
- package/dist/applicationinsights-core-js.js +53 -37
- 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 +12 -2
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +67 -44
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +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 +1 -1
- 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 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-esm/applicationinsights-core-js.js +2 -2
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/DataCacheHelper.ts +1 -1
- package/src/JavaScriptSDK/InstrumentHooks.ts +74 -47
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +1 -1
- package/types/JavaScriptSDK/InstrumentHooks.d.ts +9 -0
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +1 -1
- package/types/applicationinsights-core-js.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.8.
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.8.1
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
export { MinChannelPriorty } from "./JavaScriptSDK.Interfaces/IChannelControls";
|
|
@@ -22,7 +22,7 @@ export { ProcessTelemetryContext, createProcessTelemetryContext
|
|
|
22
22
|
} from "./JavaScriptSDK/ProcessTelemetryContext";
|
|
23
23
|
export { initializePlugins, sortPlugins, unloadComponents } from "./JavaScriptSDK/TelemetryHelpers";
|
|
24
24
|
export { _InternalMessageId, LoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
|
|
25
|
-
export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs } from "./JavaScriptSDK/InstrumentHooks";
|
|
25
|
+
export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from "./JavaScriptSDK/InstrumentHooks";
|
|
26
26
|
export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from "./JavaScriptSDK/CookieMgr";
|
|
27
27
|
export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils";
|
|
28
28
|
export { createUniqueNamespace } from "./JavaScriptSDK/DataCacheHelper";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseCore } from \"./JavaScriptSDK/BaseCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { CoreUtils, EventHelper, Undefined, newGuid, perfNow, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr } from \"./JavaScriptSDK/CoreUtils\";\r\nexport { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal, objExtend, objToString, deepFreeze } from \"./JavaScriptSDK/HelperFuncs\";\r\nexport { createEnumStyle, createEnumMap, createValueMap } from \"./JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nexport { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from \"./JavaScriptSDK/EventHelpers\";\r\nexport { getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported } from \"./JavaScriptSDK/EnvUtils\";\r\nexport { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from \"@microsoft/applicationinsights-shims\";\r\nexport { NotificationManager } from \"./JavaScriptSDK/NotificationManager\";\r\nexport { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from \"./JavaScriptSDK/PerfManager\";\r\nexport { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from \"./JavaScriptSDK/DiagnosticLogger\";\r\nexport { ProcessTelemetryContext, createProcessTelemetryContext\r\n// Explicitly NOT exporting createProcessTelemetryUnloadContext() and createProcessTelemetryUpdateContext() as these should only be created internally\r\n } from \"./JavaScriptSDK/ProcessTelemetryContext\";\r\nexport { initializePlugins, sortPlugins, unloadComponents } from \"./JavaScriptSDK/TelemetryHelpers\";\r\nexport { _InternalMessageId, LoggingSeverity } from \"./JavaScriptSDK.Enums/LoggingEnums\";\r\nexport { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs } from \"./JavaScriptSDK/InstrumentHooks\";\r\nexport { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from \"./JavaScriptSDK/CookieMgr\";\r\nexport { getDebugListener, getDebugExt } from \"./JavaScriptSDK/DbgExtensionUtils\";\r\nexport { createUniqueNamespace } from \"./JavaScriptSDK/DataCacheHelper\";\r\nexport { createUnloadHandlerContainer } from \"./JavaScriptSDK/UnloadHandlerContainer\";\r\n//# sourceMappingURL=applicationinsights-core-js.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseCore } from \"./JavaScriptSDK/BaseCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { CoreUtils, EventHelper, Undefined, newGuid, perfNow, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr } from \"./JavaScriptSDK/CoreUtils\";\r\nexport { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal, objExtend, objToString, deepFreeze } from \"./JavaScriptSDK/HelperFuncs\";\r\nexport { createEnumStyle, createEnumMap, createValueMap } from \"./JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nexport { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from \"./JavaScriptSDK/EventHelpers\";\r\nexport { getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported } from \"./JavaScriptSDK/EnvUtils\";\r\nexport { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from \"@microsoft/applicationinsights-shims\";\r\nexport { NotificationManager } from \"./JavaScriptSDK/NotificationManager\";\r\nexport { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from \"./JavaScriptSDK/PerfManager\";\r\nexport { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from \"./JavaScriptSDK/DiagnosticLogger\";\r\nexport { ProcessTelemetryContext, createProcessTelemetryContext\r\n// Explicitly NOT exporting createProcessTelemetryUnloadContext() and createProcessTelemetryUpdateContext() as these should only be created internally\r\n } from \"./JavaScriptSDK/ProcessTelemetryContext\";\r\nexport { initializePlugins, sortPlugins, unloadComponents } from \"./JavaScriptSDK/TelemetryHelpers\";\r\nexport { _InternalMessageId, LoggingSeverity } from \"./JavaScriptSDK.Enums/LoggingEnums\";\r\nexport { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from \"./JavaScriptSDK/InstrumentHooks\";\r\nexport { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from \"./JavaScriptSDK/CookieMgr\";\r\nexport { getDebugListener, getDebugExt } from \"./JavaScriptSDK/DbgExtensionUtils\";\r\nexport { createUniqueNamespace } from \"./JavaScriptSDK/DataCacheHelper\";\r\nexport { createUnloadHandlerContainer } from \"./JavaScriptSDK/UnloadHandlerContainer\";\r\n//# sourceMappingURL=applicationinsights-core-js.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/applicationinsights-core-js",
|
|
3
3
|
"author": "Microsoft Application Insights Team",
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.1",
|
|
5
5
|
"description": "Microsoft Application Insights Core Javascript SDK",
|
|
6
6
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
7
7
|
"keywords": [
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { strShimFunction, strShimPrototype } from "@microsoft/applicationinsights-shims";
|
|
8
8
|
import { hasOwnProperty, _getObjProto } from "./HelperFuncs";
|
|
9
9
|
import { getGlobalInst } from "./EnvUtils";
|
|
10
|
+
import { createElmNodeData } from "./DataCacheHelper";
|
|
10
11
|
|
|
11
12
|
const aiInstrumentHooks = "_aiHooks";
|
|
12
13
|
|
|
@@ -109,15 +110,17 @@ function _createFunctionHook(aiHook:IInstrumentHooks) {
|
|
|
109
110
|
|
|
110
111
|
// Call the original function was called
|
|
111
112
|
let theFunc = aiHook.f;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
if (theFunc) {
|
|
114
|
+
try {
|
|
115
|
+
funcArgs.rslt = theFunc.apply(funcThis, orgArgs);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
// Report the request callback
|
|
118
|
+
funcArgs.err = err;
|
|
119
|
+
_doCallbacks(hooks, funcArgs, cbArgs, hookCtx, CallbackType.FunctionError);
|
|
120
|
+
|
|
121
|
+
// rethrow the original exception so anyone listening for it can catch the exception
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
// Call the post-request hooks
|
|
@@ -170,6 +173,47 @@ export function InstrumentProtos(target:any, funcNames:string[], callbacks: IIns
|
|
|
170
173
|
return null;
|
|
171
174
|
}
|
|
172
175
|
|
|
176
|
+
function _createInstrumentHook(owner: any, funcName: string, fn: any, callbacks: IInstrumentHooksCallbacks) {
|
|
177
|
+
let aiHook: IInstrumentHooks = fn && fn[aiInstrumentHooks];
|
|
178
|
+
if (!aiHook) {
|
|
179
|
+
// Only hook the function once
|
|
180
|
+
aiHook = {
|
|
181
|
+
i: 0,
|
|
182
|
+
n: funcName,
|
|
183
|
+
f: fn,
|
|
184
|
+
h: []
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Override (hook) the original function
|
|
188
|
+
let newFunc = _createFunctionHook(aiHook);
|
|
189
|
+
newFunc[aiInstrumentHooks] = aiHook; // Tag and store the function hooks
|
|
190
|
+
owner[funcName] = newFunc;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const theHook: IInstrumentHook = {
|
|
194
|
+
// tslint:disable:object-literal-shorthand
|
|
195
|
+
id: aiHook.i,
|
|
196
|
+
cbks: callbacks,
|
|
197
|
+
rm: function () {
|
|
198
|
+
// DO NOT Use () => { shorthand for the function as the this gets replaced
|
|
199
|
+
// with the outer this and not the this for theHook instance.
|
|
200
|
+
let id = this.id;
|
|
201
|
+
_arrLoop(aiHook.h, (hook, idx) => {
|
|
202
|
+
if (hook.id === id) {
|
|
203
|
+
aiHook.h.splice(idx, 1);
|
|
204
|
+
return 1;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
// tslint:enable:object-literal-shorthand
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
aiHook.i++;
|
|
212
|
+
aiHook.h.push(theHook);
|
|
213
|
+
|
|
214
|
+
return theHook;
|
|
215
|
+
}
|
|
216
|
+
|
|
173
217
|
/**
|
|
174
218
|
* Intercept the named prototype functions for the target class / object
|
|
175
219
|
* @param target - The target object
|
|
@@ -183,44 +227,7 @@ export function InstrumentFunc(target:any, funcName:string, callbacks: IInstrume
|
|
|
183
227
|
if (owner) {
|
|
184
228
|
let fn = owner[funcName]
|
|
185
229
|
if (typeof fn === strShimFunction) {
|
|
186
|
-
|
|
187
|
-
if (!aiHook) {
|
|
188
|
-
// Only hook the function once
|
|
189
|
-
aiHook = {
|
|
190
|
-
i: 0,
|
|
191
|
-
n: funcName,
|
|
192
|
-
f: fn,
|
|
193
|
-
h: []
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
// Override (hook) the original function
|
|
197
|
-
let newFunc = _createFunctionHook(aiHook);
|
|
198
|
-
newFunc[aiInstrumentHooks] = aiHook; // Tag and store the function hooks
|
|
199
|
-
owner[funcName] = newFunc;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const theHook: IInstrumentHook = {
|
|
203
|
-
// tslint:disable:object-literal-shorthand
|
|
204
|
-
id: aiHook.i,
|
|
205
|
-
cbks: callbacks,
|
|
206
|
-
rm: function() {
|
|
207
|
-
// DO NOT Use () => { shorthand for the function as the this gets replaced
|
|
208
|
-
// with the outer this and not the this for theHook instance.
|
|
209
|
-
let id = this.id;
|
|
210
|
-
_arrLoop(aiHook.h, (hook, idx) => {
|
|
211
|
-
if (hook.id === id) {
|
|
212
|
-
aiHook.h.splice(idx, 1);
|
|
213
|
-
return 1;
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
// tslint:enable:object-literal-shorthand
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
aiHook.i ++;
|
|
221
|
-
aiHook.h.push(theHook);
|
|
222
|
-
|
|
223
|
-
return theHook;
|
|
230
|
+
return _createInstrumentHook(owner, funcName, fn, callbacks);
|
|
224
231
|
}
|
|
225
232
|
}
|
|
226
233
|
}
|
|
@@ -250,3 +257,23 @@ export function InstrumentFuncs(target:any, funcNames:string[], callbacks: IInst
|
|
|
250
257
|
|
|
251
258
|
return hooks;
|
|
252
259
|
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Add an instrumentation hook to the provided named "event" for the target class / object, this doesn't check whether the
|
|
263
|
+
* named "event" is in fact a function and just assigns the instrumentation hook to the target[evtName]
|
|
264
|
+
* @param target - The target object
|
|
265
|
+
* @param evtName - The name of the event
|
|
266
|
+
* @param callbacks - The callbacks to configure and call whenever the function is called
|
|
267
|
+
* @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
|
|
268
|
+
*/
|
|
269
|
+
export function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype:boolean = true): IInstrumentHook {
|
|
270
|
+
if (target && evtName && callbacks) {
|
|
271
|
+
let owner = _getOwner(target, evtName, checkPrototype);
|
|
272
|
+
if (owner) {
|
|
273
|
+
return _createInstrumentHook(owner, evtName, owner[evtName], callbacks);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
|
|
@@ -45,7 +45,7 @@ export function createEnumMap<E, I = keyof E>(values: { [key in keyof E]: E[keyo
|
|
|
45
45
|
* @param values - The values to populate on the new object
|
|
46
46
|
* @returns
|
|
47
47
|
*/
|
|
48
|
-
export function createValueMap<E, V = E>(values: { [key in keyof E]: [
|
|
48
|
+
export function createValueMap<E, V = E>(values: { [key in keyof E]: [ E[keyof E], V[keyof V] ] }): V {
|
|
49
49
|
let mapClass: any = {};
|
|
50
50
|
objForEachKey(values, (field, value) => {
|
|
51
51
|
mapClass[field] = value[1];
|
|
@@ -29,3 +29,12 @@ export declare function InstrumentFunc(target: any, funcName: string, callbacks:
|
|
|
29
29
|
* @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
|
|
30
30
|
*/
|
|
31
31
|
export declare function InstrumentFuncs(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook[];
|
|
32
|
+
/**
|
|
33
|
+
* Add an instrumentation hook to the provided named "event" for the target class / object, this doesn't check whether the
|
|
34
|
+
* named "event" is in fact a function and just assigns the instrumentation hook to the target[evtName]
|
|
35
|
+
* @param target - The target object
|
|
36
|
+
* @param evtName - The name of the event
|
|
37
|
+
* @param callbacks - The callbacks to configure and call whenever the function is called
|
|
38
|
+
* @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
|
|
39
|
+
*/
|
|
40
|
+
export declare function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
|
|
@@ -30,5 +30,5 @@ export declare function createEnumMap<E, I = keyof E>(values: {
|
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
32
|
export declare function createValueMap<E, V = E>(values: {
|
|
33
|
-
[key in keyof E]: [
|
|
33
|
+
[key in keyof E]: [E[keyof E], V[keyof V]];
|
|
34
34
|
}): V;
|
|
@@ -32,7 +32,7 @@ export { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _
|
|
|
32
32
|
export { ProcessTelemetryContext, createProcessTelemetryContext } from "./JavaScriptSDK/ProcessTelemetryContext";
|
|
33
33
|
export { initializePlugins, sortPlugins, unloadComponents } from "./JavaScriptSDK/TelemetryHelpers";
|
|
34
34
|
export { _InternalMessageId, _eInternalMessageId, LoggingSeverity, eLoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
|
|
35
|
-
export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs } from "./JavaScriptSDK/InstrumentHooks";
|
|
35
|
+
export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from "./JavaScriptSDK/InstrumentHooks";
|
|
36
36
|
export { ICookieMgr, ICookieMgrConfig } from "./JavaScriptSDK.Interfaces/ICookieMgr";
|
|
37
37
|
export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from "./JavaScriptSDK/CookieMgr";
|
|
38
38
|
export { IDbgExtension } from "./JavaScriptSDK.Interfaces/IDbgExtension";
|