As described above, the initial update message from the dialog gives you its ID, in
Framework.Ask({
title: "Are you sure?",
text: "You have 5 seconds to answer...",
}, function (Msg) {
if (!Msg.result) {
// No .result in message. Therefore, it's the initial creation of the dialog.
// Set a timer which destroys the dialog after 5 seconds if the
// user has not answered.
setTimeout(function() {
Framework.DestroyDialog(Msg.widgetId);
}, 5000);
} else {
// Result from the dialog. Can either be the user clicking the button,
// or termination of the dialog by the above DestroyDialog()
}
});