[Vuejs]-Async/await in NativeScript-vue. Why dialogs won't show in correct order_?

1👍

It’s because an alert dialog in web browser blocks all other JavaScript code running on main thread. Also alert(...) returns void on Web.

In NativeScript alert(...) returns a promise which ensures the dialog is closed. When the same code is executed in {N}, it doesn’t wait for alert(...) dialog to be closed as you are not returning the promise.

speak(incoming) {
  this.message = incoming + " speech";
  return alert(incoming);
},
👤Manoj

Leave a comment