@microsoft/applicationinsights-web-basic 2.8.0-beta.2203-10 → 2.8.0-beta.2203-13

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/index.ts DELETED
@@ -1,125 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- import {
5
- IConfiguration,
6
- AppInsightsCore,
7
- IAppInsightsCore,
8
- _InternalMessageId,
9
- isNullOrUndefined,
10
- arrForEach,
11
- ITelemetryItem,
12
- SendRequestReason,
13
- throwError
14
- } from "@microsoft/applicationinsights-core-js";
15
- import { IConfig } from "@microsoft/applicationinsights-common";
16
- import { Sender } from "@microsoft/applicationinsights-channel-js";
17
-
18
- "use strict";
19
-
20
- /**
21
- * @export
22
- * @class ApplicationInsights
23
- */
24
- export class ApplicationInsights {
25
- public config: IConfiguration & IConfig;
26
- private core: IAppInsightsCore;
27
-
28
- /**
29
- * Creates an instance of ApplicationInsights.
30
- * @param {IConfiguration & IConfig} config
31
- * @memberof ApplicationInsights
32
- */
33
- constructor(config: IConfiguration & IConfig) {
34
- // initialize the queue and config in case they are undefined
35
- if (
36
- isNullOrUndefined(config) ||
37
- isNullOrUndefined(config.instrumentationKey)
38
- ) {
39
- throwError("Invalid input configuration");
40
- }
41
- this.config = config;
42
- this.getSKUDefaults();
43
-
44
- this.initialize();
45
- }
46
-
47
- /**
48
- * Initialize this instance of ApplicationInsights
49
- *
50
- * @memberof ApplicationInsights
51
- */
52
- public initialize(): void {
53
- this.core = new AppInsightsCore();
54
- const extensions = [];
55
- const appInsightsChannel: Sender = new Sender();
56
-
57
- extensions.push(appInsightsChannel);
58
-
59
- // initialize core
60
- this.core.initialize(this.config, extensions);
61
-
62
- // initialize extensions
63
- appInsightsChannel.initialize(this.config, this.core, extensions);
64
-
65
- this.pollInternalLogs();
66
- }
67
-
68
- /**
69
- * Send a manually constructed custom event
70
- *
71
- * @param {ITelemetryItem} item
72
- * @memberof ApplicationInsights
73
- */
74
- public track(item: ITelemetryItem) {
75
- this.core.track(item);
76
- }
77
-
78
- /**
79
- * Immediately send all batched telemetry
80
- * @param {boolean} [async=true]
81
- * @memberof ApplicationInsights
82
- */
83
- public flush(async: boolean = true) {
84
- arrForEach(this.core.getTransmissionControls(), controls => {
85
- arrForEach(controls, plugin => {
86
- async
87
- ? (plugin as Sender).flush()
88
- : (plugin as Sender).triggerSend(async, null, SendRequestReason.ManualFlush);
89
- });
90
- });
91
- }
92
-
93
- private pollInternalLogs(): void {
94
- this.core.pollInternalLogs();
95
- }
96
-
97
- public stopPollingInternalLogs(): void {
98
- this.core.stopPollingInternalLogs();
99
- }
100
-
101
- private getSKUDefaults() {
102
- this.config.diagnosticLogInterval =
103
- this.config.diagnosticLogInterval && this.config.diagnosticLogInterval > 0 ? this.config.diagnosticLogInterval : 10000;
104
- }
105
-
106
- }
107
-
108
- export {
109
- IConfiguration,
110
- AppInsightsCore,
111
- IAppInsightsCore,
112
- CoreUtils,
113
- ITelemetryItem
114
- } from "@microsoft/applicationinsights-core-js";
115
- export {
116
- SeverityLevel,
117
- IPageViewTelemetry,
118
- IDependencyTelemetry,
119
- IAutoExceptionTelemetry,
120
- IEventTelemetry,
121
- IMetricTelemetry,
122
- IPageViewPerformanceTelemetry,
123
- ITraceTelemetry
124
- } from "@microsoft/applicationinsights-common";
125
- export { Sender } from "@microsoft/applicationinsights-channel-js";