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
4 changes: 2 additions & 2 deletions AISKU/src/AISku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class AppInsightsSku implements IApplicationInsights {
// Empty queue of all api calls logged prior to sdk download
_self.emptyQueue();
_self.pollInternalLogs();
_self.addHousekeepingBeforeUnload(this);
_self.addHousekeepingBeforeUnload(_self);
});

return _self;
Expand Down Expand Up @@ -317,7 +317,7 @@ export class AppInsightsSku implements IApplicationInsights {

// Back up the current session to local storage
// This lets us close expired sessions after the cookies themselves expire
if (isFunction(this.core.getPlugin)) {
if (isFunction(_self.core.getPlugin)) {
let loadedPlugin = this.core.getPlugin(PropertiesPluginIdentifier);
if (loadedPlugin) {
let propertiesPlugin: any = loadedPlugin.plugin;
Expand Down
2 changes: 1 addition & 1 deletion channels/applicationinsights-channel-js/src/Sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {

// invoke send
if (forcedSender) {
result = forcedSender.call(this, payload, async);
result = forcedSender.call(_self, payload, async);
} else {
result = _self._sender(payload, async);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
_populateDefaults(config);

_pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);
_pageViewManager = new PageViewManager(this, _extConfig.overridePageViewDuration, _self.core, _pageViewPerformanceManager);
_pageViewManager = new PageViewManager(_self, _extConfig.overridePageViewDuration, _self.core, _pageViewPerformanceManager);
_pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), (pageName, pageUrl, pageVisitTime) => trackPageVisitTime(pageName, pageUrl, pageVisitTime))

_eventTracking = new Timing(_self.diagLog(), "trackEvent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class PageViewPerformanceManager {
"error calculating page view performance.",
{ total, network, request, response, dom });

} else if (!this.shouldCollectDuration(total, network, request, response, dom)) {
} else if (!_self.shouldCollectDuration(total, network, request, response, dom)) {
_throwInternal(_logger,
eLoggingSeverity.WARNING,
_eInternalMessageId.InvalidDurationValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class ClickAnalyticsPlugin extends BaseTelemetryPlugin {
let logger = _self.diagLog();
_contentHandler = new DomContentHandler(_config, logger);
let metaTags = _contentHandler.getMetadata();
_pageAction = new PageAction(this, _config, _contentHandler, _config.callback.pageActionPageTags, metaTags, logger);
_pageAction = new PageAction(_self, _config, _contentHandler, _config.callback.pageActionPageTags, metaTags, logger);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the source of the issue in that when the onConfigChange is re-called the this is undefined which then causes the creation of a new PageAction with undefined as the ClickAnalytics instance.

I've also looked for a "fixed" other potential issues of the same in the other classes. This doesn't replace "all" of the this usages as there are some where the this does need to represent the current execution context (ie. this)


// Default to DOM autoCapture handler
if (_autoCaptureHandler) {
Expand Down