feat(alert): accept Promise for button handler (#25702)

Resolves #25700

Co-authored-by: Sean Perkins <sean@ionic.io>
This commit is contained in:
Hans Krywalsky
2022-08-03 17:33:37 +02:00
committed by GitHub
parent 11c69c8df5
commit 8e4783c172
4 changed files with 68 additions and 9 deletions

View File

@ -53,10 +53,12 @@ export type AlertTextareaAttributes = { [key: string]: any };
*/
export type AlertInputAttributes = { [key: string]: any };
type AlertButtonOverlayHandler = boolean | void | { [key: string]: any };
export interface AlertButton {
text: string;
role?: 'cancel' | 'destructive' | string;
cssClass?: string | string[];
id?: string;
handler?: (value: any) => boolean | void | { [key: string]: any };
handler?: (value: any) => AlertButtonOverlayHandler | Promise<AlertButtonOverlayHandler>;
}