Skip to content

Instantly share code, notes, and snippets.

@davecra
Last active July 27, 2017 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davecra/4ad27e6b73124daa821eeaa4c19e296b to your computer and use it in GitHub Desktop.
Save davecra/4ad27e6b73124daa821eeaa4c19e296b to your computer and use it in GitHub Desktop.
Issue where a dialog will not be display if you close and open another one real quick
var i = 0;
function displayDialog() {
var url = "https://localhost:3000/test.html";
Office.context.ui.displayDialogAsync(url,{height:20, width:30, displayInIframe:true},
function (asyncResult) {
var dialog = asyncResult.value; // get the dialog
var error = asyncResult.error;
if(dialog == undefined && error.code > 0) {
// log the error
console.log(error.message);
} else {
// attache the events
dialog.addEventHandler(Office.EventType.DialogEventReceived, function (arg) {
// close this dialog, open the next
dialog.close();
i++;
if(i<4) {
displayDialog();
}
});
dialog.addEventHandler(Office.EventType.DialogMessageReceived, function (arg) {
// close this dialog, open the next
dialog.close();
i++;
if(i<4) {
displayDialog();
}
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment