Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix telemetry context function type #474

Merged
merged 2 commits into from
Jun 9, 2017
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
2 changes: 1 addition & 1 deletion API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ Sends telemetry to the endpoint.

### addTelemetryInitializer

public addTelemetryInitializer(telemetryInitializer: (envelope: Telemetry.Common.Envelope) => boolean)
public addTelemetryInitializer(telemetryInitializer: (envelope: Telemetry.Common.Envelope) => boolean | void)
Copy link
Member

Choose a reason for hiding this comment

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

Is it a back compat change (e.g. we now require a Boolean but previously were OK with void)? If not - we may simply want to update instructions in the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's a back compatibility change. We were always accepting bool|void, but definition types only allowed boolean.


Adds a telemetry initializer to the collection. Telemetry initializers will be called one by one, in the order they were added,
before the telemetry item is pushed for sending.
Expand Down
1 change: 1 addition & 0 deletions JavaScript/JavaScriptSDK.Interfaces/Telemetry/IEnvelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ module Microsoft.ApplicationInsights {
appVer: string;
userId: string;
tags: { [name: string]: any };
data: any;
}
}
4 changes: 2 additions & 2 deletions JavaScript/JavaScriptSDK/TelemetryContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module Microsoft.ApplicationInsights {
/**
* The array of telemetry initializers to call before sending each telemetry item.
*/
private telemetryInitializers: { (envelope: Microsoft.ApplicationInsights.IEnvelope): boolean; }[];
private telemetryInitializers: { (envelope: Microsoft.ApplicationInsights.IEnvelope): boolean | void; }[];

/**
* The session manager that manages session on the base of cookies.
Expand Down Expand Up @@ -98,7 +98,7 @@ module Microsoft.ApplicationInsights {
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
* before telemetry item is pushed for sending and in the order they were added.
*/
public addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean) {
public addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean | void) {
this.telemetryInitializers = this.telemetryInitializers || [];
this.telemetryInitializers.push(telemetryInitializer);
}
Expand Down