Commit 33ad4c78 by Sebastián Katzer

Support badge property on windows platform

parent cb3e2e80
......@@ -54,8 +54,8 @@ exports.core = {
* 'schedule' or 'update'
*/
schedule: function (notifications) {
var triggerFn = function (notification) {
this.updateBadge(notification.badge);
this.fireEvent('trigger', notification);
};
......@@ -128,6 +128,25 @@ exports.core = {
},
/**
* Updates the badge number of the active tile.
*
* @param {Number} badge
* The badge number. Zero will clean the badge.
*/
updateBadge: function (badge) {
var notifications = Windows.UI.Notifications,
type = notifications.BadgeTemplateType.badgeNumber,
xml = notifications.BadgeUpdateManager.getTemplateContent(type),
attrs = xml.getElementsByTagName('badge'),
notification = new notifications.BadgeNotification(xml);
attrs[0].setAttribute('value', badge);
notifications.BadgeUpdateManager.createBadgeUpdaterForApplication()
.update(notification);
},
/**
* Updates a single local notification.
*
* @param {Object} notification
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment