Skip to content

Commit

Permalink
refactor(devtools): Use chrome.devtools.performance types
Browse files Browse the repository at this point in the history
The chrome.devtools.performance types were added to the DefinitelyTyped
module and as such we don't need to make use of any to circumvent
the missing types.

See: DefinitelyTyped/DefinitelyTyped#70231
  • Loading branch information
and-oli committed Sep 27, 2024
1 parent 7c7969c commit c549247
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions devtools/projects/shell-browser/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ export class AppComponent implements OnInit {
chrome.devtools.network.onNavigated.addListener(() => {
window.location.reload();
});
// At the moment the chrome.devtools.performance namespace does not
// have an entry in DefinitelyTyped, so this is a temporary
// workaround to prevent TypeScript failures while the corresponding
// type is added upstream.
const chromeDevToolsPerformance = (chrome.devtools as any).performance;
const chromeDevToolsPerformance = chrome.devtools.performance;
chromeDevToolsPerformance?.onProfilingStarted?.addListener?.(this.onProfilingStartedListener);
chromeDevToolsPerformance?.onProfilingStopped?.addListener?.(this.onProfilingStoppedListener);

this._cd.detectChanges();
}
ngOnDestroy(): void {
const chromeDevToolsPerformance = (chrome.devtools as any).performance;
const chromeDevToolsPerformance = chrome.devtools.performance;
chromeDevToolsPerformance?.onProfilingStarted?.removeListener?.(
this.onProfilingStartedListener,
);
Expand Down

0 comments on commit c549247

Please sign in to comment.