@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
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
1
|
+
import { IAppInsightsCore, ILoadedPlugin } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
2
2
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
3
|
-
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
3
|
+
import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
4
4
|
import { IChannelControls } from "../JavaScriptSDK.Interfaces/IChannelControls";
|
|
5
5
|
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
6
6
|
import { INotificationManager } from "../JavaScriptSDK.Interfaces/INotificationManager";
|
|
7
|
+
import { INotificationListener } from "../JavaScriptSDK.Interfaces/INotificationListener";
|
|
7
8
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
8
|
-
import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
9
|
+
import { IProcessTelemetryContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
9
10
|
import { IPerfManager } from "../JavaScriptSDK.Interfaces/IPerfManager";
|
|
10
11
|
import { ICookieMgr } from "../JavaScriptSDK.Interfaces/ICookieMgr";
|
|
12
|
+
import { ITelemetryInitializerHandler, TelemetryInitializerFunction } from "../JavaScriptSDK.Interfaces/ITelemetryInitializers";
|
|
13
|
+
import { UnloadHandler } from "./UnloadHandlerContainer";
|
|
14
|
+
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
15
|
+
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
16
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
11
17
|
export declare class BaseCore implements IAppInsightsCore {
|
|
12
18
|
static defaultConfig: IConfiguration;
|
|
13
19
|
config: IConfiguration;
|
|
@@ -20,6 +26,18 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
20
26
|
track(telemetryItem: ITelemetryItem): void;
|
|
21
27
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
22
28
|
getNotifyMgr(): INotificationManager;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
31
|
+
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
32
|
+
* called.
|
|
33
|
+
* @param {INotificationListener} listener - An INotificationListener object.
|
|
34
|
+
*/
|
|
35
|
+
addNotificationListener(listener: INotificationListener): void;
|
|
36
|
+
/**
|
|
37
|
+
* Removes all instances of the listener.
|
|
38
|
+
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
39
|
+
*/
|
|
40
|
+
removeNotificationListener(listener: INotificationListener): void;
|
|
23
41
|
/**
|
|
24
42
|
* Get the current cookie manager for this instance
|
|
25
43
|
*/
|
|
@@ -32,5 +50,65 @@ export declare class BaseCore implements IAppInsightsCore {
|
|
|
32
50
|
getPerfMgr(): IPerfManager;
|
|
33
51
|
setPerfMgr(perfMgr: IPerfManager): void;
|
|
34
52
|
eventCnt(): number;
|
|
53
|
+
/**
|
|
54
|
+
* Periodically check logger.queue for
|
|
55
|
+
*/
|
|
56
|
+
pollInternalLogs(eventName?: string): number;
|
|
57
|
+
/**
|
|
58
|
+
* Periodically check logger.queue for
|
|
59
|
+
*/
|
|
60
|
+
stopPollingInternalLogs(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
63
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
64
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
65
|
+
*/
|
|
66
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
67
|
+
/**
|
|
68
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
69
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
70
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
71
|
+
* approach is to create a new instance and initialize that instance.
|
|
72
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
73
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
74
|
+
* @param isAsync - Can the unload be performed asynchronously (default)
|
|
75
|
+
* @param unloadComplete - An optional callback that will be called once the unload has completed
|
|
76
|
+
* @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
|
|
77
|
+
*/
|
|
78
|
+
unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
|
|
79
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
80
|
+
/**
|
|
81
|
+
* Add a new plugin to the installation
|
|
82
|
+
* @param plugin - The new plugin to add
|
|
83
|
+
* @param replaceExisting - should any existing plugin be replaced, default is false
|
|
84
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
85
|
+
* @param addCb - [Optional] callback to call after the plugin has been added
|
|
86
|
+
*/
|
|
87
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
|
|
88
|
+
/**
|
|
89
|
+
* Returns the unique event namespace that should be used
|
|
90
|
+
*/
|
|
91
|
+
evtNamespace(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
94
|
+
* @param handler - the handler
|
|
95
|
+
*/
|
|
96
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
97
|
+
/**
|
|
98
|
+
* Flush and send any batched / cached data immediately
|
|
99
|
+
* @param async - send data asynchronously when true (defaults to true)
|
|
100
|
+
* @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
|
|
101
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
102
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
103
|
+
* @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
|
|
104
|
+
*/
|
|
105
|
+
flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
|
|
35
106
|
protected releaseQueue(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
|
|
109
|
+
* @param updateCtx - The plugin update context
|
|
110
|
+
* @param updateState - The Update State
|
|
111
|
+
* @returns boolean - True means the extension class will call updateState otherwise the Core will
|
|
112
|
+
*/
|
|
113
|
+
protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
36
114
|
}
|
|
@@ -3,14 +3,25 @@ import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
|
3
3
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
4
4
|
import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
5
5
|
import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
6
|
-
import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
6
|
+
import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
|
|
7
7
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
8
|
+
import { UnloadHandler } from "./UnloadHandlerContainer";
|
|
9
|
+
import { IInstrumentHook } from "../JavaScriptSDK.Interfaces/IInstrumentHooks";
|
|
10
|
+
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
11
|
+
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
8
12
|
/**
|
|
9
13
|
* BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
|
|
10
14
|
* can avoid implementation the same set of boiler plate code as well as provide a base
|
|
11
15
|
* implementation so that new default implementations can be added without breaking all plugins.
|
|
12
16
|
*/
|
|
13
17
|
export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
18
|
+
identifier: string;
|
|
19
|
+
version?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Holds the core instance that was used during initialization
|
|
22
|
+
*/
|
|
23
|
+
core: IAppInsightsCore;
|
|
24
|
+
priority: number;
|
|
14
25
|
/**
|
|
15
26
|
* Call back for telemetry processing before it it is sent
|
|
16
27
|
* @param env - This is the current event being reported
|
|
@@ -32,13 +43,6 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
32
43
|
* Returns whether the plugin has been initialized
|
|
33
44
|
*/
|
|
34
45
|
isInitialized: () => boolean;
|
|
35
|
-
identifier: string;
|
|
36
|
-
version?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Holds the core instance that was used during initialization
|
|
39
|
-
*/
|
|
40
|
-
core: IAppInsightsCore;
|
|
41
|
-
priority: number;
|
|
42
46
|
/**
|
|
43
47
|
* Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
|
|
44
48
|
* returns that value (helps with minification for callers), otherwise it will return the configured
|
|
@@ -51,10 +55,49 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
51
55
|
*/
|
|
52
56
|
protected setInitialized: (isInitialized: boolean) => void;
|
|
53
57
|
/**
|
|
54
|
-
*
|
|
58
|
+
* Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
|
|
59
|
+
* finishes it's removal.
|
|
60
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
61
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
62
|
+
* @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
|
|
63
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
64
|
+
*/
|
|
65
|
+
protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
|
|
68
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
69
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
70
|
+
* @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.
|
|
71
|
+
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
55
72
|
*/
|
|
56
|
-
|
|
73
|
+
protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
|
|
57
74
|
constructor();
|
|
58
75
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
76
|
+
/**
|
|
77
|
+
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
78
|
+
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
79
|
+
* processTelemetry calls are ignored and it just calls the processNext() with the provided context.
|
|
80
|
+
* @param unloadCtx - This is the context that should be used during unloading.
|
|
81
|
+
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
82
|
+
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
83
|
+
*/
|
|
84
|
+
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
59
85
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
86
|
+
/**
|
|
87
|
+
* The the plugin should re-evaluate configuration and update any cached configuration settings.
|
|
88
|
+
* @param updateCtx - This is the context that should be used during updating.
|
|
89
|
+
* @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
|
|
90
|
+
* @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
|
|
91
|
+
*/
|
|
92
|
+
update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
95
|
+
* @param handler - the handler
|
|
96
|
+
*/
|
|
97
|
+
protected _addUnloadCb(handler: UnloadHandler): void;
|
|
98
|
+
/**
|
|
99
|
+
* Add this hook so that it is automatically removed during unloading
|
|
100
|
+
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
101
|
+
*/
|
|
102
|
+
protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
|
|
60
103
|
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
+
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
1
2
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
2
|
-
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
3
3
|
import { IChannelControls } from "../JavaScriptSDK.Interfaces/IChannelControls";
|
|
4
|
-
import {
|
|
4
|
+
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
5
|
+
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
5
6
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Static constructor, attempt to create accessors
|
|
19
|
-
*/
|
|
20
|
-
private static _staticInit;
|
|
7
|
+
export declare const ChannelControllerPriority = 500;
|
|
8
|
+
export interface IChannelController extends IChannelControls {
|
|
9
|
+
flush(isAsync: boolean, callBack: (flushComplete?: boolean) => void, sendReason: SendRequestReason, cbTimeout?: number): void;
|
|
10
|
+
getChannel<T extends IPlugin = IPlugin>(pluginIdentifier: string): T;
|
|
11
|
+
}
|
|
12
|
+
export interface IInternalChannelController extends IChannelController {
|
|
13
|
+
_setQueue: (channels: _IInternalChannels[]) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface _IInternalChannels {
|
|
16
|
+
queue: IChannelControls[];
|
|
17
|
+
chain: ITelemetryPluginChain;
|
|
21
18
|
}
|
|
19
|
+
export declare function createChannelControllerPlugin(channelQueue: _IInternalChannels[], core: IAppInsightsCore): IChannelController;
|
|
20
|
+
export declare function createChannelQueues(channels: IChannelControls[][], extensions: IPlugin[], config: IConfiguration, core: IAppInsightsCore): _IInternalChannels[];
|
|
@@ -2,59 +2,12 @@ import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
|
2
2
|
import { ICookieMgr } from "../JavaScriptSDK.Interfaces/ICookieMgr";
|
|
3
3
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
4
4
|
export declare const Undefined = "undefined";
|
|
5
|
-
/**
|
|
6
|
-
* Trys to add an event handler for the specified event to the window, body and document
|
|
7
|
-
* @param eventName {string} - The name of the event
|
|
8
|
-
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
9
|
-
* @return {boolean} - true if the handler was successfully added
|
|
10
|
-
*/
|
|
11
|
-
export declare function addEventHandler(eventName: string, callback: any): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Bind the listener to the array of events
|
|
14
|
-
* @param events An string array of event names to bind the listener to
|
|
15
|
-
* @param listener The event callback to call when the event is triggered
|
|
16
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
17
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
18
|
-
*/
|
|
19
|
-
export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
|
|
22
|
-
* this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden
|
|
23
|
-
* it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is
|
|
24
|
-
* just navigating to a different Tab and may come back (without unloading the page). As such you may also
|
|
25
|
-
* need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
|
|
26
|
-
* @param listener - The event callback to call when a page unload event is triggered
|
|
27
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
|
|
28
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
29
|
-
*/
|
|
30
|
-
export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Listen to the pagehide and visibility changing to 'hidden' events
|
|
33
|
-
* @param listener - The event callback to call when a page hide event is triggered
|
|
34
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
35
|
-
* Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
|
|
36
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
37
|
-
*/
|
|
38
|
-
export declare function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Listen to the pageshow and visibility changing to 'visible' events
|
|
41
|
-
* @param listener - The event callback to call when a page is show event is triggered
|
|
42
|
-
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
43
|
-
* @returns true - when at least one of the events was registered otherwise false
|
|
44
|
-
*/
|
|
45
|
-
export declare function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
|
|
46
5
|
export declare function newGuid(): string;
|
|
47
6
|
/**
|
|
48
7
|
* Return the current value of the Performance Api now() function (if available) and fallback to dateNow() if it is unavailable (IE9 or less)
|
|
49
8
|
* https://caniuse.com/#search=performance.now
|
|
50
9
|
*/
|
|
51
10
|
export declare function perfNow(): number;
|
|
52
|
-
/**
|
|
53
|
-
* Generate random base64 id string.
|
|
54
|
-
* The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)
|
|
55
|
-
* @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22
|
|
56
|
-
*/
|
|
57
|
-
export declare function newId(maxLength?: number): string;
|
|
58
11
|
/**
|
|
59
12
|
* The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
|
|
60
13
|
* @param value - The value to check whether it ends with the search value.
|
|
@@ -199,7 +152,7 @@ export interface ICoreUtils {
|
|
|
199
152
|
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
200
153
|
* @return {boolean} - true if the handler was successfully added
|
|
201
154
|
*/
|
|
202
|
-
addEventHandler: (eventName: string, callback: any) => boolean;
|
|
155
|
+
addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
|
|
203
156
|
/**
|
|
204
157
|
* Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
|
|
205
158
|
* https://caniuse.com/#search=Date.now
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface IDataCache {
|
|
2
|
+
id: string;
|
|
3
|
+
accept: (target: any) => boolean;
|
|
4
|
+
get: <T>(target: any, name: string, defValue?: T, addDefault?: boolean) => T;
|
|
5
|
+
kill: (target: any, name: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function createUniqueNamespace(name: string, includeVersion?: boolean): string;
|
|
8
|
+
export declare function createElmNodeData(name?: string): {
|
|
9
|
+
id: string;
|
|
10
|
+
accept: (target: any) => boolean;
|
|
11
|
+
get: <T>(target: any, name: string, defValue?: T, addDefault?: boolean) => T;
|
|
12
|
+
kill: (target: any, name: string) => void;
|
|
13
|
+
};
|
|
@@ -63,3 +63,13 @@ export declare class DiagnosticLogger implements IDiagnosticLogger {
|
|
|
63
63
|
*/
|
|
64
64
|
logInternalMessage(severity: LoggingSeverity, message: _InternalLogMessage): void;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* This is a helper method which will call throwInternal on the passed logger, will throw exceptions in
|
|
68
|
+
* debug mode or attempt to log the error as a console warning. This helper is provided mostly to better
|
|
69
|
+
* support minification as logger.throwInternal() will not compress the publish "throwInternal" used throughout
|
|
70
|
+
* the code.
|
|
71
|
+
* @param logger - The Diagnostic Logger instance to use.
|
|
72
|
+
* @param severity {LoggingSeverity} - The severity of the log message
|
|
73
|
+
* @param message {_InternalLogMessage} - The log message.
|
|
74
|
+
*/
|
|
75
|
+
export declare function _throwInternal(logger: IDiagnosticLogger, severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export interface _IRegisteredEvents {
|
|
2
|
+
name: string;
|
|
3
|
+
handler: any;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
|
|
7
|
+
* applications to remove their own events
|
|
8
|
+
* @param target - The EventTarget that has registered events
|
|
9
|
+
* @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
|
|
10
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
11
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
12
|
+
*/
|
|
13
|
+
export declare function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
|
|
14
|
+
export declare function mergeEvtNamespace(theNamespace: string, namespaces?: string | string[] | null): string | string[];
|
|
15
|
+
/**
|
|
16
|
+
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
17
|
+
* @param obj Object to add the event too.
|
|
18
|
+
* @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
|
|
19
|
+
* namespaces "click" "click.mynamespace" in addition to specific namespaces.
|
|
20
|
+
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
21
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
22
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
23
|
+
* @param useCapture [Optional] Defaults to false
|
|
24
|
+
* @returns True if the function was bound successfully to the event, otherwise false
|
|
25
|
+
*/
|
|
26
|
+
export declare function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Removes an event handler for the specified event
|
|
29
|
+
* @param Object to remove the event from
|
|
30
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
31
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
32
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
33
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
34
|
+
* otherwise this will only remove events with this specific handler.
|
|
35
|
+
* @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
|
|
36
|
+
* if the eventName also includes a namespace the namespace(s) are merged into a single namespace
|
|
37
|
+
* @param useCapture [Optional] Defaults to false
|
|
38
|
+
*/
|
|
39
|
+
export declare function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
|
|
40
|
+
/**
|
|
41
|
+
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
42
|
+
* @param obj Object to add the event too.
|
|
43
|
+
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
|
|
44
|
+
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
45
|
+
* @param useCapture [Optional] Defaults to false
|
|
46
|
+
* @returns True if the function was bound successfully to the event, otherwise false
|
|
47
|
+
*/
|
|
48
|
+
export declare function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Removes an event handler for the specified event
|
|
51
|
+
* @param Object to remove the event from
|
|
52
|
+
* @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
53
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
54
|
+
* @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
|
|
55
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
56
|
+
* otherwise this will only remove events with this specific handler.
|
|
57
|
+
* @param useCapture [Optional] Defaults to false
|
|
58
|
+
*/
|
|
59
|
+
export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
|
|
60
|
+
/**
|
|
61
|
+
* Trys to add an event handler for the specified event to the window, body and document
|
|
62
|
+
* @param eventName {string} - The name of the event
|
|
63
|
+
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
64
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
65
|
+
* @return {boolean} - true if the handler was successfully added
|
|
66
|
+
*/
|
|
67
|
+
export declare function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Trys to remove event handler(s) for the specified event/namespace to the window, body and document
|
|
70
|
+
* @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
|
|
71
|
+
* such as "click", "click.mynamespace" or ".mynamespace"
|
|
72
|
+
* @param callback {any} - - The callback function that needs to be removed from the given event, when using a
|
|
73
|
+
* namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
|
|
74
|
+
* otherwise this will only remove events with this specific handler.
|
|
75
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
76
|
+
*/
|
|
77
|
+
export declare function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): void;
|
|
78
|
+
/**
|
|
79
|
+
* Bind the listener to the array of events
|
|
80
|
+
* @param events An string array of event names to bind the listener to
|
|
81
|
+
* @param listener The event callback to call when the event is triggered
|
|
82
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
83
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
84
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
85
|
+
*/
|
|
86
|
+
export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Remove the listener from the array of events
|
|
89
|
+
* @param events An string array of event names to bind the listener to
|
|
90
|
+
* @param listener The event callback to call when the event is triggered
|
|
91
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
92
|
+
*/
|
|
93
|
+
export declare function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
|
|
94
|
+
/**
|
|
95
|
+
* Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
|
|
96
|
+
* this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden
|
|
97
|
+
* it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is
|
|
98
|
+
* just navigating to a different Tab and may come back (without unloading the page). As such you may also
|
|
99
|
+
* need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
|
|
100
|
+
* @param listener - The event callback to call when a page unload event is triggered
|
|
101
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
|
|
102
|
+
* @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
|
|
103
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
104
|
+
*/
|
|
105
|
+
export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
|
|
108
|
+
* addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
|
|
109
|
+
* @param listener - The specific event callback to to be removed
|
|
110
|
+
* @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
|
|
111
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
112
|
+
*/
|
|
113
|
+
export declare function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
|
|
114
|
+
/**
|
|
115
|
+
* Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
|
|
116
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
117
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
118
|
+
* @param listener - The event callback to call when a page hide event is triggered
|
|
119
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
120
|
+
* @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
|
|
121
|
+
* based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
122
|
+
* so that only the matching "removePageHideEventListener" can remove these events.
|
|
123
|
+
* Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
|
|
124
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
125
|
+
*/
|
|
126
|
+
export declare function addPageHideEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
|
|
129
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
|
|
130
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
131
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
132
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
133
|
+
*/
|
|
134
|
+
export declare function removePageHideEventListener(listener: any, evtNamespace?: string | string[] | null): void;
|
|
135
|
+
/**
|
|
136
|
+
* Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
|
|
137
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
|
|
138
|
+
* removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
139
|
+
* @param listener - The event callback to call when a page is show event is triggered
|
|
140
|
+
* @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
|
|
141
|
+
* @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
|
|
142
|
+
* identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
|
|
143
|
+
* so that only the matching "removePageShowEventListener" can remove these events.
|
|
144
|
+
* @returns true - when at least one of the events was registered otherwise false
|
|
145
|
+
*/
|
|
146
|
+
export declare function addPageShowEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
|
|
149
|
+
* an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener
|
|
150
|
+
* as the remove ignores the listener argument for the 'visibilitychange' event.
|
|
151
|
+
* @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
|
|
152
|
+
* @param evtNamespace - The unique namespace used when calling addPageShowEventListener
|
|
153
|
+
*/
|
|
154
|
+
export declare function removePageShowEventListener(listener: any, evtNamespace?: string | string[] | null): void;
|
|
@@ -1,34 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
5
|
export declare function _getObjProto(target: any): any;
|
|
6
6
|
export declare function objToString(obj: any): any;
|
|
7
7
|
export declare function isTypeof(value: any, theType: string): boolean;
|
|
8
|
-
export declare function isUndefined(value: any):
|
|
9
|
-
export declare function isNotUndefined(value:
|
|
10
|
-
export declare function isNullOrUndefined(value: any):
|
|
11
|
-
export declare function isNotNullOrUndefined(value:
|
|
8
|
+
export declare function isUndefined(value: any): value is undefined;
|
|
9
|
+
export declare function isNotUndefined<T>(value: T): value is T;
|
|
10
|
+
export declare function isNullOrUndefined(value: any): value is null | undefined;
|
|
11
|
+
export declare function isNotNullOrUndefined<T>(value: T): value is T;
|
|
12
12
|
export declare function hasOwnProperty(obj: any, prop: string): boolean;
|
|
13
|
-
export declare function isObject(value:
|
|
13
|
+
export declare function isObject<T>(value: T): value is T;
|
|
14
14
|
export declare function isFunction(value: any): value is Function;
|
|
15
|
-
|
|
16
|
-
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
17
|
-
* @param obj Object to add the event too.
|
|
18
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
19
|
-
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
20
|
-
* @param useCapture [Optional] Defaults to false
|
|
21
|
-
* @returns True if the function was bound successfully to the event, otherwise false
|
|
22
|
-
*/
|
|
23
|
-
export declare function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Removes an event handler for the specified event
|
|
26
|
-
* @param Object to remove the event from
|
|
27
|
-
* @param eventNameWithoutOn {string} - The name of the event
|
|
28
|
-
* @param handlerRef {any} - The callback function that needs to be executed for the given event
|
|
29
|
-
* @param useCapture [Optional] Defaults to false
|
|
30
|
-
*/
|
|
31
|
-
export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
|
|
15
|
+
export declare function isPromiseLike<T>(value: any): value is PromiseLike<T>;
|
|
32
16
|
/**
|
|
33
17
|
* Validates that the string name conforms to the JS IdentifierName specification and if not
|
|
34
18
|
* normalizes the name so that it would. This method does not identify or change any keywords
|
|
@@ -43,7 +27,7 @@ export declare function normalizeJsName(name: string): string;
|
|
|
43
27
|
* @param target The target object to find and process the keys
|
|
44
28
|
* @param callbackfn The function to call with the details
|
|
45
29
|
*/
|
|
46
|
-
export declare function objForEachKey(target:
|
|
30
|
+
export declare function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void): void;
|
|
47
31
|
/**
|
|
48
32
|
* The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
|
|
49
33
|
* @param value - The value to check whether it ends with the search value.
|
|
@@ -83,7 +67,8 @@ export declare function strContains(value: string, search: string): boolean;
|
|
|
83
67
|
*/
|
|
84
68
|
export declare function isDate(obj: any): obj is Date;
|
|
85
69
|
/**
|
|
86
|
-
* Check if an object is of type Array
|
|
70
|
+
* Check if an object is of type Array with optional generic T, the generic type is not validated
|
|
71
|
+
* and exists to help with TypeScript validation only.
|
|
87
72
|
*/
|
|
88
73
|
export declare let isArray: <T = any>(obj: any) => obj is Array<T>;
|
|
89
74
|
/**
|
|
@@ -136,7 +121,7 @@ export declare function _toISOStringPoly(date: Date): string;
|
|
|
136
121
|
* @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
|
|
137
122
|
* @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.
|
|
138
123
|
*/
|
|
139
|
-
export declare function arrForEach<T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
|
|
124
|
+
export declare function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
|
|
140
125
|
/**
|
|
141
126
|
* Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
142
127
|
* that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
|
|
@@ -186,6 +171,7 @@ export declare function objKeys(obj: {}): string[];
|
|
|
186
171
|
* @returns True if it was able to create the accessors otherwise false
|
|
187
172
|
*/
|
|
188
173
|
export declare function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
|
|
174
|
+
export declare function deepFreeze<T>(obj: T): T;
|
|
189
175
|
export declare const objFreeze: <T>(value: T) => T;
|
|
190
176
|
export declare const objSeal: <T>(value: T) => T;
|
|
191
177
|
/**
|
|
@@ -207,7 +193,7 @@ export declare function getExceptionName(object: any): string;
|
|
|
207
193
|
* @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)
|
|
208
194
|
* @returns The existing or new value, depending what was set
|
|
209
195
|
*/
|
|
210
|
-
export declare function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
|
|
196
|
+
export declare 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): T[K];
|
|
211
197
|
/**
|
|
212
198
|
* Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it
|
|
213
199
|
* @param target - The target object to return or set the default value
|
|
@@ -232,15 +218,29 @@ export declare function throwError(message: string): never;
|
|
|
232
218
|
* @param target - The target object to be assigned with the source properties and functions
|
|
233
219
|
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
234
220
|
* @param chkSet - An optional callback to determine whether a specific property/function should be proxied
|
|
235
|
-
* @memberof Initialization
|
|
236
221
|
*/
|
|
237
|
-
export declare function proxyAssign(target:
|
|
222
|
+
export declare function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
|
|
223
|
+
export declare function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
|
|
224
|
+
/**
|
|
225
|
+
* Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
|
|
226
|
+
*
|
|
227
|
+
* @param target - The target object to be assigned with the source properties and functions
|
|
228
|
+
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
229
|
+
* @param functionsToProxy - An array of function names that will be proxied on the target
|
|
230
|
+
*/
|
|
231
|
+
export declare function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
|
|
238
232
|
/**
|
|
239
233
|
* Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.
|
|
240
234
|
* Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance
|
|
241
235
|
* @param defaults Simple helper
|
|
242
236
|
*/
|
|
243
237
|
export declare function createClassFromInterface<T>(defaults?: T): new () => T;
|
|
238
|
+
/**
|
|
239
|
+
* Create an enum style object which has both the key => value and value => key mappings
|
|
240
|
+
* @param values - The values to populate on the new object
|
|
241
|
+
* @returns
|
|
242
|
+
*/
|
|
243
|
+
export declare function createEnumStyle<T>(values: T): T;
|
|
244
244
|
/**
|
|
245
245
|
* A helper function to assist with JIT performance for objects that have properties added / removed dynamically
|
|
246
246
|
* this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this
|
|
@@ -259,4 +259,5 @@ export declare function optimizeObject<T>(theObject: T): T;
|
|
|
259
259
|
* @param obj5 - object to merge.
|
|
260
260
|
* @returns The extended first object.
|
|
261
261
|
*/
|
|
262
|
-
export declare function objExtend<
|
|
262
|
+
export declare function objExtend<T2, T3, T4, T5, T6>(deepExtend?: boolean, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T2 & T3 & T4 & T5 & T6;
|
|
263
|
+
export declare 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;
|