Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions channels/applicationinsights-channel-js/src/Sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,12 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {
endpoint: _endpointUrl,
version: EnvelopeCreator.Version
} as IStatsBeatConfig;
return _self.core.getStatsBeat(statsBeatConfig);

let core = _self.core;

// During page unload the core may have been cleared and some async events may not have been sent yet
// resulting in the core being null. In this case we don't want to create a statsbeat instance
return core ? core.getStatsBeat(statsBeatConfig) : null;
}

function _xdrOnLoad (xdr: IXDomainRequest, payload: IInternalStorageItem[]) {
Expand Down Expand Up @@ -1304,12 +1309,21 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {
// Using function lookups for backward compatibility as the getNotifyMgr() did not exist until after v2.5.6
function _getNotifyMgr() : INotificationManager {
const func = "getNotifyMgr";
if (_self.core[func]) {
return _self.core[func]();
let result: INotificationManager;
let core = _self.core;
if (core) {
// During page unload the core may have been cleared and some async events may not have been sent yet
// resulting in the core being null. In this case we don't want to create a statsbeat instance

if (core[func]) {
result = core[func]();
} else {
// using _self.core['_notificationManager'] for backward compatibility
result = (core as any)["_notificationManager"];
}
}

// using _self.core['_notificationManager'] for backward compatibility
return _self.core["_notificationManager"];
return result;
}

function _notifySendRequest(sendRequest: SendRequestReason, isAsync: boolean) {
Expand Down Expand Up @@ -1469,7 +1483,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {

/**
* error handler
* @Internal
* @internal
* since version 3.2.0, if the payload is string[], this function is no-op (string[] is only used for backwards Compatibility)
*/
public _onError(payload: string[] | IInternalStorageItem[], message: string, event?: ErrorEvent) {
Expand All @@ -1478,7 +1492,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {

/**
* partial success handler
* @Internal
* @internal
* since version 3.2.0, if the payload is string[], this function is no-op (string[] is only used for backwards Compatibility)
*/
public _onPartialSuccess(payload: string[] | IInternalStorageItem[], results: IBackendResponse) {
Expand All @@ -1487,7 +1501,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {

/**
* success handler
* @Internal
* @internal
* since version 3.2.0, if the payload is string[], this function is no-op (string[] is only used for backwards Compatibility)
*/
public _onSuccess(payload: string[] | IInternalStorageItem[], countOfItemsInPayload: number) {
Expand Down
13 changes: 0 additions & 13 deletions common/config/rush/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tools/chrome-debug-extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "Telemetry Viewer - M3",
"short_name": "Telemetry Viewer M3",
"description": "A browser extension that provides a real time view of what's happening in Application Insights including what telemetry is being logged by the web application",
"version": "0.7.5",
"version_name": "0.7.5",
"version": "0.8.0",
"version_name": "0.8.0",
"manifest_version": 3,
"icons": {
"16": "images/icon-16.png",
Expand Down
Loading