Dialogs are asynchronous; you'll need to wait on a promise in order to delay until the user's dealt with the input.
The easiest thing to do is to return the promise from your call to showAsync. Change this:
messagedialogpopup.showAsync().done(function (command) {
to
return messagedialogpopup.showAsync().then(function (command) {
if (command) {
if (command.id == 1) {
console.log('proceed in popup is false');
return false;
}
else if (command.id == 2) {
console.log('proceed in popup is true');
return true;
}
}
});
and change the call to doSillyMessage to:
doSillyMessage().then(function (proceed) {
// proceed will be true or false
});
Mark if helps