showDialogAsync()
Shows a dialog activity, and returns a promise that resolves when the dialog is closed.
showDialogAsync<T extends Activity>(dialog: T): Promise<T>;
Parameters
- dialog — The dialog activity to show
Return value
A promise that resolves with the dialog activity after it has been unlinked
Description
This method activates the provided activity as a dialog, and resolves the returned promise when the dialog activity is unlinked (either by itself, e.g. when the user confirms or cancels, or when the parent activity is deactivated).
- The dialog activity’s render mode is set to
dialogbefore activation. The dialog can override this in its afterActive method (e.g. to show as a page on smaller viewports). - The dialog activity is attached to this activity, and is automatically unlinked when this activity is deactivated or unlinked.
- The returned promise resolves with the (now unlinked) dialog activity, so that results can be read from its properties, e.g. a
resultproperty that’s only set when confirmed.
Examples
// Show a dialog and handle the result
let dialog = await this.showDialogAsync(new MyDialogActivity());
if (dialog.result) {
// ... handle result
}
Related
class Activity
A class that represents a part of the application that can be activated when the user navigates to it.
