MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / alert

Function alert

packages/core/ui/dialogs/index.android.ts:122–151  ·  view source on GitHub ↗
(arg: any)

Source from the content-addressed store, hash-verified

120}
121
122export function alert(arg: any): Promise<void> {
123 return new Promise<void>((resolve, reject) => {
124 try {
125 const options = !isDialogOptions(arg) ? { title: DialogStrings.ALERT, okButtonText: DialogStrings.OK, message: arg + '' } : arg;
126
127 const alert = createAlertDialog(options);
128
129 alert.setPositiveButton(
130 options.okButtonText,
131 new android.content.DialogInterface.OnClickListener({
132 onClick: function (dialog: android.content.DialogInterface, id: number) {
133 dialog.cancel();
134 resolve();
135 },
136 }),
137 );
138 alert.setOnDismissListener(
139 new android.content.DialogInterface.OnDismissListener({
140 onDismiss: function () {
141 resolve();
142 },
143 }),
144 );
145
146 showDialog(alert);
147 } catch (ex) {
148 reject(ex);
149 }
150 });
151}
152
153export function confirm(arg: any): Promise<boolean> {
154 return new Promise<boolean>((resolve, reject) => {

Callers

nothing calls this directly

Calls 5

isDialogOptionsFunction · 0.90
createAlertDialogFunction · 0.85
showDialogFunction · 0.85
cancelMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected