@microsoft/applicationinsights-core-js 3.0.0-beta.2208-03 → 3.0.0-beta.2208-16
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/README.md +7 -0
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2040 -2155
- 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 +6998 -10817
- package/dist/applicationinsights-core-js.api.md +88 -177
- package/dist/applicationinsights-core-js.d.ts +94 -494
- package/dist/applicationinsights-core-js.js +2040 -2155
- 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 +94 -494
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +2 -2
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +11 -12
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +3 -2
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +2 -2
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +27 -26
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +8 -140
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +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 +3 -3
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +4 -3
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +132 -136
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +2 -3
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +23 -470
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +5 -5
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +4 -4
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +2 -2
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +4 -8
- package/dist-esm/JavaScriptSDK/PerfManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +3 -3
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +2 -2
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +3 -3
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +2 -3
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +2 -2
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +5 -31
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +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/IDistributedTraceContext.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/ITraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-esm/__DynamicConstants.js +11 -13
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +6 -5
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +4 -3
- package/src/JavaScriptSDK/AppInsightsCore.ts +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +2 -4
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +2 -1
- package/src/JavaScriptSDK/ChannelController.ts +1 -1
- package/src/JavaScriptSDK/CookieMgr.ts +6 -5
- package/src/JavaScriptSDK/CoreUtils.ts +7 -423
- package/src/JavaScriptSDK/DbgExtensionUtils.ts +2 -2
- package/src/JavaScriptSDK/DiagnosticLogger.ts +3 -2
- package/src/JavaScriptSDK/EnvUtils.ts +145 -148
- package/src/JavaScriptSDK/EventHelpers.ts +1 -2
- package/src/JavaScriptSDK/HelperFuncs.ts +22 -536
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -4
- package/src/JavaScriptSDK/InternalConstants.ts +3 -3
- package/src/JavaScriptSDK/NotificationManager.ts +1 -1
- package/src/JavaScriptSDK/PerfManager.ts +3 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +4 -4
- package/src/JavaScriptSDK/TelemetryHelpers.ts +1 -1
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +2 -2
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +1 -2
- package/src/JavaScriptSDK/W3cTraceParent.ts +1 -1
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +5 -36
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +7 -0
- package/tsconfig.json +1 -1
- package/types/JavaScriptSDK/CoreUtils.d.ts +0 -270
- package/types/JavaScriptSDK/EnvUtils.d.ts +0 -65
- package/types/JavaScriptSDK/HelperFuncs.d.ts +3 -154
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +6 -18
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +6 -0
- package/types/__DynamicConstants.d.ts +2 -4
- package/types/applicationinsights-core-js.d.ts +5 -4
- package/types/tsdoc-metadata.json +1 -1
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
"use strict"
|
|
4
4
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
5
|
+
import { dumpObj, isFunction, isUndefined } from "@nevware21/ts-utils";
|
|
5
6
|
import { LoggingSeverity, _InternalMessageId, _eInternalMessageId, eLoggingSeverity } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
6
7
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
7
8
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
8
9
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
9
10
|
import { getDebugExt } from "./DbgExtensionUtils";
|
|
10
|
-
import {
|
|
11
|
-
import { getCfgValue
|
|
11
|
+
import { getConsole, getJSON, hasJSON } from "./EnvUtils";
|
|
12
|
+
import { getCfgValue } from "./HelperFuncs";
|
|
12
13
|
import { STR_EMPTY, STR_ERROR_TO_CONSOLE, STR_WARN_TO_CONSOLE } from "./InternalConstants";
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { isString, isUndefined
|
|
5
|
+
import { strShimObject, strShimPrototype, strShimUndefined } from "@microsoft/applicationinsights-shims";
|
|
6
|
+
import { getDocument, getInst, getNavigator, hasNavigator, isString, isUndefined } from "@nevware21/ts-utils";
|
|
7
|
+
import { strContains } from "./HelperFuncs";
|
|
7
8
|
import { STR_EMPTY } from "./InternalConstants";
|
|
8
9
|
|
|
9
10
|
// TypeScript removed this interface so we need to declare the global so we can check for it's existence.
|
|
@@ -16,11 +17,7 @@ declare var XDomainRequest: any;
|
|
|
16
17
|
* functions/properties only need to include those that are used within their own modules.
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
|
-
const strWindow = "window";
|
|
20
|
-
const strDocument = "document";
|
|
21
20
|
const strDocumentMode = "documentMode";
|
|
22
|
-
const strNavigator = "navigator";
|
|
23
|
-
const strHistory = "history";
|
|
24
21
|
const strLocation = "location";
|
|
25
22
|
const strConsole = "console";
|
|
26
23
|
const strPerformance = "performance";
|
|
@@ -75,122 +72,122 @@ export function setEnableEnvMocks(enabled: boolean) {
|
|
|
75
72
|
_enableMocks = enabled;
|
|
76
73
|
}
|
|
77
74
|
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
export
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
export function getWindow(): Window | null {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
export function hasDocument(): boolean {
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
export function getDocument(): Document | null {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
export function hasNavigator(): boolean {
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
export function getNavigator(): Navigator | null {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
export function hasHistory(): boolean {
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
export function getHistory(): History | null {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
75
|
+
// /**
|
|
76
|
+
// * Return the named global object if available, will return null if the object is not available.
|
|
77
|
+
// * @param name The globally named object
|
|
78
|
+
// */
|
|
79
|
+
// export function getinst<T>(name:string): T {
|
|
80
|
+
// let gbl = getGlobal();
|
|
81
|
+
// if (gbl && gbl[name]) {
|
|
82
|
+
// return gbl[name] as T;
|
|
83
|
+
// }
|
|
84
|
+
|
|
85
|
+
// // Test workaround, for environments where <global>.window (when global == window) doesn't return the base window
|
|
86
|
+
// if (name === strWindow && hasWindow()) {
|
|
87
|
+
// // tslint:disable-next-line: no-angle-bracket-type-assertion
|
|
88
|
+
// return <any>window as T;
|
|
89
|
+
// }
|
|
90
|
+
|
|
91
|
+
// return null;
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
// /**
|
|
95
|
+
// * Checks if window object is available, this is required as we support the API running without a
|
|
96
|
+
// * window /document (eg. Node server, electron webworkers) and if we attempt to assign a window
|
|
97
|
+
// * object to a local variable or pass as an argument an "Uncaught ReferenceError: window is not defined"
|
|
98
|
+
// * exception will be thrown.
|
|
99
|
+
// * Defined as a function to support lazy / late binding environments.
|
|
100
|
+
// */
|
|
101
|
+
// export const hasWindow = () => boolean = hasWindow;
|
|
102
|
+
// return Boolean(typeof window === strShimObject && window);
|
|
103
|
+
// }
|
|
104
|
+
|
|
105
|
+
// /**
|
|
106
|
+
// * Returns the global window object if it is present otherwise null.
|
|
107
|
+
// * This helper is used to access the window object without causing an exception
|
|
108
|
+
// * "Uncaught ReferenceError: window is not defined"
|
|
109
|
+
// */
|
|
110
|
+
// export function getWindow(): Window | null {
|
|
111
|
+
// if (hasWindow()) {
|
|
112
|
+
// return window;
|
|
113
|
+
// }
|
|
114
|
+
|
|
115
|
+
// // Return the global instance or null
|
|
116
|
+
// return getInst(strWindow);
|
|
117
|
+
// }
|
|
118
|
+
|
|
119
|
+
// /**
|
|
120
|
+
// * Checks if document object is available, this is required as we support the API running without a
|
|
121
|
+
// * window /document (eg. Node server, electron webworkers) and if we attempt to assign a document
|
|
122
|
+
// * object to a local variable or pass as an argument an "Uncaught ReferenceError: document is not defined"
|
|
123
|
+
// * exception will be thrown.
|
|
124
|
+
// * Defined as a function to support lazy / late binding environments.
|
|
125
|
+
// */
|
|
126
|
+
// export function hasDocument(): boolean {
|
|
127
|
+
// return Boolean(typeof document === strShimObject && document);
|
|
128
|
+
// }
|
|
129
|
+
|
|
130
|
+
// /**
|
|
131
|
+
// * Returns the global document object if it is present otherwise null.
|
|
132
|
+
// * This helper is used to access the document object without causing an exception
|
|
133
|
+
// * "Uncaught ReferenceError: document is not defined"
|
|
134
|
+
// */
|
|
135
|
+
// export function getDocument(): Document | null {
|
|
136
|
+
// if (hasDocument()) {
|
|
137
|
+
// return document;
|
|
138
|
+
// }
|
|
139
|
+
|
|
140
|
+
// return getInst(strDocument);
|
|
141
|
+
// }
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// /**
|
|
145
|
+
// * Checks if navigator object is available, this is required as we support the API running without a
|
|
146
|
+
// * window /document (eg. Node server, electron webworkers) and if we attempt to assign a navigator
|
|
147
|
+
// * object to a local variable or pass as an argument an "Uncaught ReferenceError: navigator is not defined"
|
|
148
|
+
// * exception will be thrown.
|
|
149
|
+
// * Defined as a function to support lazy / late binding environments.
|
|
150
|
+
// */
|
|
151
|
+
// export function hasNavigator(): boolean {
|
|
152
|
+
// return Boolean(typeof navigator === strShimObject && navigator);
|
|
153
|
+
// }
|
|
154
|
+
|
|
155
|
+
// /**
|
|
156
|
+
// * Returns the global navigator object if it is present otherwise null.
|
|
157
|
+
// * This helper is used to access the navigator object without causing an exception
|
|
158
|
+
// * "Uncaught ReferenceError: navigator is not defined"
|
|
159
|
+
// */
|
|
160
|
+
// export function getNavigator(): Navigator | null {
|
|
161
|
+
// if (hasNavigator()) {
|
|
162
|
+
// return navigator;
|
|
163
|
+
// }
|
|
164
|
+
|
|
165
|
+
// return getInst(strNavigator);
|
|
166
|
+
// }
|
|
167
|
+
|
|
168
|
+
// /**
|
|
169
|
+
// * Checks if history object is available, this is required as we support the API running without a
|
|
170
|
+
// * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history
|
|
171
|
+
// * object to a local variable or pass as an argument an "Uncaught ReferenceError: history is not defined"
|
|
172
|
+
// * exception will be thrown.
|
|
173
|
+
// * Defined as a function to support lazy / late binding environments.
|
|
174
|
+
// */
|
|
175
|
+
// export function hasHistory(): boolean {
|
|
176
|
+
// return Boolean(typeof history === strShimObject && history);
|
|
177
|
+
// }
|
|
178
|
+
|
|
179
|
+
// /**
|
|
180
|
+
// * Returns the global history object if it is present otherwise null.
|
|
181
|
+
// * This helper is used to access the history object without causing an exception
|
|
182
|
+
// * "Uncaught ReferenceError: history is not defined"
|
|
183
|
+
// */
|
|
184
|
+
// export function getHistory(): History | null {
|
|
185
|
+
// if (hasHistory()) {
|
|
186
|
+
// return history;
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
// return getInst(strHistory);
|
|
190
|
+
// }
|
|
194
191
|
|
|
195
192
|
/**
|
|
196
193
|
* Returns the global location object if it is present otherwise null.
|
|
@@ -199,7 +196,7 @@ export function getHistory(): History | null {
|
|
|
199
196
|
*/
|
|
200
197
|
export function getLocation(checkForMock?: boolean): Location | null {
|
|
201
198
|
if (checkForMock && _enableMocks) {
|
|
202
|
-
let mockLocation =
|
|
199
|
+
let mockLocation = getInst("__mockLocation") as Location;
|
|
203
200
|
if (mockLocation) {
|
|
204
201
|
return mockLocation;
|
|
205
202
|
}
|
|
@@ -209,7 +206,7 @@ export function getLocation(checkForMock?: boolean): Location | null {
|
|
|
209
206
|
return location;
|
|
210
207
|
}
|
|
211
208
|
|
|
212
|
-
return
|
|
209
|
+
return getInst(strLocation);
|
|
213
210
|
}
|
|
214
211
|
|
|
215
212
|
/**
|
|
@@ -220,7 +217,7 @@ export function getConsole(): Console | null {
|
|
|
220
217
|
return console;
|
|
221
218
|
}
|
|
222
219
|
|
|
223
|
-
return
|
|
220
|
+
return getInst(strConsole);
|
|
224
221
|
}
|
|
225
222
|
|
|
226
223
|
/**
|
|
@@ -229,7 +226,7 @@ export function getConsole(): Console | null {
|
|
|
229
226
|
* global instance which could be window or globalThis for a web worker
|
|
230
227
|
*/
|
|
231
228
|
export function getPerformance(): Performance | null {
|
|
232
|
-
return
|
|
229
|
+
return getInst(strPerformance);
|
|
233
230
|
}
|
|
234
231
|
|
|
235
232
|
/**
|
|
@@ -240,7 +237,7 @@ export function getPerformance(): Performance | null {
|
|
|
240
237
|
* Defined as a function to support lazy / late binding environments.
|
|
241
238
|
*/
|
|
242
239
|
export function hasJSON(): boolean {
|
|
243
|
-
return Boolean((typeof JSON === strShimObject && JSON) ||
|
|
240
|
+
return Boolean((typeof JSON === strShimObject && JSON) || getInst(strJSON) !== null);
|
|
244
241
|
}
|
|
245
242
|
|
|
246
243
|
/**
|
|
@@ -250,7 +247,7 @@ export function hasJSON(): boolean {
|
|
|
250
247
|
*/
|
|
251
248
|
export function getJSON(): JSON | null {
|
|
252
249
|
if (hasJSON()) {
|
|
253
|
-
return JSON ||
|
|
250
|
+
return JSON || getInst(strJSON);
|
|
254
251
|
}
|
|
255
252
|
|
|
256
253
|
return null;
|
|
@@ -262,7 +259,7 @@ export function getJSON(): JSON | null {
|
|
|
262
259
|
* global instance which could be window or globalThis for a web worker
|
|
263
260
|
*/
|
|
264
261
|
export function getCrypto(): Crypto | null {
|
|
265
|
-
return
|
|
262
|
+
return getInst(strCrypto);
|
|
266
263
|
}
|
|
267
264
|
|
|
268
265
|
/**
|
|
@@ -271,7 +268,7 @@ export function getCrypto(): Crypto | null {
|
|
|
271
268
|
* global instance which could be window or globalThis for a web worker
|
|
272
269
|
*/
|
|
273
270
|
export function getMsCrypto(): Crypto | null {
|
|
274
|
-
return
|
|
271
|
+
return getInst(strMsCrypto);
|
|
275
272
|
}
|
|
276
273
|
|
|
277
274
|
/**
|
|
@@ -326,20 +323,20 @@ export function getIEVersion(userAgentStr: string = null): number {
|
|
|
326
323
|
return null;
|
|
327
324
|
}
|
|
328
325
|
|
|
329
|
-
/**
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
export function dumpObj(object: any): string {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
326
|
+
// /**
|
|
327
|
+
// * Returns string representation of an object suitable for diagnostics logging.
|
|
328
|
+
// */
|
|
329
|
+
// export function dumpObj(object: any): string {
|
|
330
|
+
// const objectTypeDump: string = Object[strShimPrototype].toString.call(object);
|
|
331
|
+
// let propertyValueDump: string = STR_EMPTY;
|
|
332
|
+
// if (objectTypeDump === "[object Error]") {
|
|
333
|
+
// propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
334
|
+
// } else if (hasJSON()) {
|
|
335
|
+
// propertyValueDump = getJSON().stringify(object);
|
|
336
|
+
// }
|
|
337
|
+
|
|
338
|
+
// return objectTypeDump + propertyValueDump;
|
|
339
|
+
// }
|
|
343
340
|
|
|
344
341
|
export function isSafari(userAgentStr ?: string) {
|
|
345
342
|
if (!userAgentStr || !isString(userAgentStr)) {
|
|
@@ -371,8 +368,8 @@ export function isBeaconsSupported(): boolean {
|
|
|
371
368
|
export function isFetchSupported(withKeepAlive?: boolean): boolean {
|
|
372
369
|
let isSupported = false;
|
|
373
370
|
try {
|
|
374
|
-
isSupported = !!
|
|
375
|
-
const request =
|
|
371
|
+
isSupported = !!getInst("fetch");
|
|
372
|
+
const request = getInst("Request");
|
|
376
373
|
if (isSupported && withKeepAlive && request) {
|
|
377
374
|
isSupported = _hasProperty(request, "keepalive");
|
|
378
375
|
}
|
|
@@ -387,7 +384,7 @@ export function useXDomainRequest(): boolean | undefined {
|
|
|
387
384
|
if (_useXDomainRequest === null) {
|
|
388
385
|
_useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
|
|
389
386
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
390
|
-
_useXDomainRequest = _useXDomainRequest && !_hasProperty(
|
|
387
|
+
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getInst(strXMLHttpRequest), "withCredentials");
|
|
391
388
|
}
|
|
392
389
|
}
|
|
393
390
|
|
|
@@ -401,7 +398,7 @@ export function useXDomainRequest(): boolean | undefined {
|
|
|
401
398
|
export function isXhrSupported(): boolean {
|
|
402
399
|
let isSupported = false;
|
|
403
400
|
try {
|
|
404
|
-
const xmlHttpRequest =
|
|
401
|
+
const xmlHttpRequest = getInst(strXMLHttpRequest);
|
|
405
402
|
isSupported = !!xmlHttpRequest;
|
|
406
403
|
} catch (e) {
|
|
407
404
|
// Just Swallow any failure during availability checks
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
import { arrForEach, arrIndexOf, getDocument, getWindow, isArray, objForEachKey, objKeys } from "@nevware21/ts-utils";
|
|
3
4
|
import { createElmNodeData, createUniqueNamespace } from "./DataCacheHelper";
|
|
4
|
-
import { getDocument, getWindow } from "./EnvUtils";
|
|
5
|
-
import { arrForEach, arrIndexOf, isArray, objForEachKey, objKeys } from "./HelperFuncs";
|
|
6
5
|
import { STR_EMPTY } from "./InternalConstants";
|
|
7
6
|
|
|
8
7
|
// Added to help with minfication
|