appInfo.msgConfirmation = app.notification.create({
icon: '<i class="icon demo-icon">7</i>',
title: 'Success!',
subtitle: 'Your message was successfully sent',
text: 'Your confirmation number is: <span id="nConfirm"></span> ',
closeButton: true,
closeTimeout: 3000,
on: {
open: function (text) {
$$("#nConfirm").text(appInfo.msgConfirmation.params.confirmation);
},
}
});
Now when I do this:
appInfo.msgConfirmation.open();
the on open event gets called and I can retrieve the confirmation # from the params and set the span with it. This makes the code reusable without having to destroy the notification in order to change the text. One could also attach an object onto the params and pass in multiple variables.