Skip to content

Commit a5f1737

Browse files
pkozlowski-opensourcedylhunn
authored andcommittedApr 3, 2023
feat(core): expose onDestroy on ApplicationRef (#49677)
This change exposes the onDestroy callback on the ApplicationRef as the public API. It is useful for cases where people need to execute cleanup logic on application teardown. Closes #49087 PR Close #49677
1 parent 7870fb0 commit a5f1737

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed
 

‎goldens/public-api/core/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export class ApplicationRef {
8787
detachView(viewRef: ViewRef): void;
8888
get injector(): EnvironmentInjector;
8989
readonly isStable: Observable<boolean>;
90+
onDestroy(callback: () => void): VoidFunction;
9091
tick(): void;
9192
get viewCount(): number;
9293
// (undocumented)

‎packages/core/src/application_ref.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1117,8 +1117,6 @@ export class ApplicationRef {
11171117
*
11181118
* @param callback A callback function to add as a listener.
11191119
* @returns A function which unregisters a listener.
1120-
*
1121-
* @internal
11221120
*/
11231121
onDestroy(callback: () => void): VoidFunction {
11241122
(typeof ngDevMode === 'undefined' || ngDevMode) && this.warnIfDestroyed();

0 commit comments

Comments
 (0)
Please sign in to comment.