refactor(common): remove load event listener once it is fired (#52512)

This commit removes the `load` event listener once it has fired within the
`ImagePerformanceWarning`. The `load` event listener prevents the zone stuff from
being garbage collected in development mode when debugging microfrontend applications
that may be destroyed multiple times.

PR Close #52512
This commit is contained in:
arturovt 2023-11-03 21:56:29 +02:00 committed by Andrew Kushnir
parent 1ce31d819b
commit 2205c8993f

View file

@ -49,7 +49,7 @@ export class ImagePerformanceWarning implements OnDestroy {
// Angular doesn't have to run change detection whenever any asynchronous tasks are invoked in
// the scope of this functionality.
this.ngZone.runOutsideAngular(() => {
this.window?.addEventListener('load', waitToScan);
this.window?.addEventListener('load', waitToScan, {once: true});
});
}
}