Skip to content

Commit f93d9ba

Browse files
Fraser KillipFraser Killip
authored andcommitted
Update to use proxy for AppInsigts context and queue rather than invalid reference on init.
1 parent 082d6f7 commit f93d9ba

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/app-insight.service.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ export class AppInsightsConfig implements Microsoft.ApplicationInsights.IConfig
4646
@Injectable()
4747
export class AppInsightsService implements IAppInsights {
4848

49-
context: Microsoft.ApplicationInsights.ITelemetryContext;
50-
queue: Array<() => void>;
49+
get context(): Microsoft.ApplicationInsights.ITelemetryContext {
50+
return AppInsights.context;
51+
}
52+
get queue(): Array<() => void> {
53+
return AppInsights.queue
54+
}
5155
config: AppInsightsConfig;
5256

5357
constructor(
@@ -242,9 +246,6 @@ export class AppInsightsService implements IAppInsights {
242246
this.stopTrackPage(event.url);
243247
});
244248
}
245-
246-
this.queue = AppInsights.queue;
247-
this.context = AppInsights.context;
248249
} catch (ex) {
249250
console.warn('Angular application insights Error [downloadAndSetup]: ', ex);
250251
}

0 commit comments

Comments
 (0)