Skip to content

Commit

Permalink
Add onCancel() to TimingTracker.
Browse files Browse the repository at this point in the history
Reviewed By: pelmers

Differential Revision: D10245550

fbshipit-source-id: 093e6ef50f4b11f3231b474fd91ded849272665b
  • Loading branch information
hchau-fb authored and pelmers committed Nov 15, 2018
1 parent b9e8093 commit e3f82ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/nuclide-commons/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,15 @@ export class TimingTracker {
this._trackTimingEvent(error);
}

onCancel(): void {
this._trackTimingEvent(/* error */ null, true);
}

onSuccess(): void {
this._trackTimingEvent(/* error */ null);
}

_trackTimingEvent(exception: ?Error): void {
_trackTimingEvent(exception: ?Error, canceled: boolean = false): void {
if (canMeasure) {
/* eslint-disable no-undef */
// call measure to add this information to the devtools timeline in the
Expand All @@ -152,6 +156,7 @@ export class TimingTracker {
eventName: this._eventName,
error: exception ? '1' : '0',
exception: exception ? exception.toString() : '',
canceled,
});
}
}
Expand Down

0 comments on commit e3f82ec

Please sign in to comment.