Skip to content

Commit 6c0bd0a

Browse files
committed
deprecates AppMountParameters.onAppLeave
1 parent d341f6a commit 6c0bd0a

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

docs/development/core/public/kibana-plugin-core-public.appleavehandler.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
## AppLeaveHandler type
66

7+
> Warning: This API is now obsolete.
8+
>
9+
> [AppMountParameters.onAppLeave](./kibana-plugin-core-public.appmountparameters.onappleave.md) has been deprecated in favor of [ScopedHistory.block](./kibana-plugin-core-public.scopedhistory.block.md)
10+
>
11+
712
A handler that will be executed before leaving the application, either when going to another application or when closing the browser tab or manually changing the url. Should return `confirm` to to prompt a message to the user before leaving the page, or `default` to keep the default behavior (doing nothing).
813

914
See [AppMountParameters](./kibana-plugin-core-public.appmountparameters.md) for detailed usage examples.

docs/development/core/public/kibana-plugin-core-public.appmountparameters.onappleave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
## AppMountParameters.onAppLeave property
66

7+
> Warning: This API is now obsolete.
8+
>
9+
> [ScopedHistory.block](./kibana-plugin-core-public.scopedhistory.block.md) should be used instead.
10+
>
11+
712
A function that can be used to register a handler that will be called when the user is leaving the current application, allowing to prompt a confirmation message before actually changing the page.
813

914
This will be called either when the user goes to another application, or when trying to close the tab or manually changing the url.

src/core/public/application/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ export interface AppMountParameters<HistoryLocationState = unknown> {
478478
* return renderApp({ element, history });
479479
* }
480480
* ```
481+
*
482+
* @deprecated {@link ScopedHistory.block} should be used instead.
481483
*/
482484
onAppLeave: (handler: AppLeaveHandler) => void;
483485

@@ -523,6 +525,7 @@ export interface AppMountParameters<HistoryLocationState = unknown> {
523525
* See {@link AppMountParameters} for detailed usage examples.
524526
*
525527
* @public
528+
* @deprecated {@link AppMountParameters.onAppLeave} has been deprecated in favor of {@link ScopedHistory.block}
526529
*/
527530
export type AppLeaveHandler = (
528531
factory: AppLeaveActionFactory,
@@ -590,6 +593,7 @@ export interface AppLeaveActionFactory {
590593
* so we can show to the user the right UX for him to saved his/her/their changes
591594
*/
592595
confirm(text: string, title?: string, callback?: () => void): AppLeaveConfirmAction;
596+
593597
/**
594598
* Returns a default action, resulting on executing the default behavior when
595599
* the user tries to leave an application

src/core/public/public.api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export interface AppLeaveDefaultAction {
116116

117117
// Warning: (ae-forgotten-export) The symbol "AppLeaveActionFactory" needs to be exported by the entry point index.d.ts
118118
//
119-
// @public
119+
// @public @deprecated
120120
export type AppLeaveHandler = (factory: AppLeaveActionFactory, nextAppId?: string) => AppLeaveAction;
121121

122122
// @public (undocumented)
@@ -153,6 +153,7 @@ export interface AppMountParameters<HistoryLocationState = unknown> {
153153
appBasePath: string;
154154
element: HTMLElement;
155155
history: ScopedHistory<HistoryLocationState>;
156+
// @deprecated
156157
onAppLeave: (handler: AppLeaveHandler) => void;
157158
setHeaderActionMenu: (menuMount: MountPoint | undefined) => void;
158159
}

0 commit comments

Comments
 (0)