This is the code:
ToastNotificationManager = Notifications.ToastNotificationManager;
toast = function(options) {
var i, textElements, texts, xml, _i, _ref;
options.template || (options.template = "toastText01");
xml = ToastNotificationManager.getTemplateContent(ToastTemplateType[options.template]);
if (!Array.isArray(options.text)) {
texts = [options.text];
}
textElements = xml.getElementsByTagName("text");
for (i = _i = 0, _ref = Math.min(texts.length, textElements.length) - 1; _i <= _ref; i = _i += 1) {
textElements[i].appendChild(xml.createTextNode(texts[i]));
}
toast = new ToastNotification(xml);
toast.onactivated = options.onactivated;
return ToastNotificationManager.createToastNotifier().show(toast);
And the XML looks valid.
<toast><visual><binding template="ToastText01"><text id="1">One document trashed.</text></binding></visual></toast>
Notifications are enabled system wide and other apps show notifications.