Created
October 9, 2012 21:36
-
-
Save domenic/3861617 to your computer and use it in GitHub Desktop.
Windows 8 toasts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var template = Windows.UI.Notifications.ToastTemplateType.toastImageAndText03; | |
var toastXml = Windows.UI.Notifications.ToastNotificationManager.getTemplateContent(template); | |
var imageEl = toastXml.getElementsByTagName("image")[0]; | |
imageEl.setAttribute("src", "ms-appx:///images/toast-image.png"); | |
imageEl.setAttribute("alt", "Alternate text"); | |
var textEls = toastXml.getElementsByTagName("text"); | |
textEls[0].innerText = "First line!"; | |
textEls[1].innerText = "Second line!"; | |
var toast = new Windows.UI.Notifications.ToastNotification(toastXml); | |
var toastNotifier = Windows.UI.Notifications.ToastNotificationManager.createToastNotifier(); | |
toastNotifier.show(toast); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var showToast = require("WinningJS/lib/ui/toasts").show; | |
showToast({ | |
type: 3, | |
image: { | |
src: "ms-appx:///images/toast-image.png", | |
alt: "Alternate text" | |
}, | |
text: ["First line!", "Second line!"] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment