Confirmed users
93
edits
Line 72: | Line 72: | ||
// This handler may be triggered *immediately* after mozSetMessageHandler is called | // This handler may be triggered *immediately* after mozSetMessageHandler is called | ||
// so applications should ensure they are ready (UI created, state loaded etc.) | // so applications should ensure they are ready (UI created, state loaded etc.) | ||
navigator.mozSetMessageHandler('push-register', { | |||
handleMessage: function(e) { | |||
// (re)issue register() calls | |||
// to register to listen for a notification, | |||
// you simply call push.register | |||
navigator.pushNotifications.register(); | |||
} | |||
}); | |||
navigator.mozSetMessageHandler('push', { | navigator.mozSetMessageHandler('push', { | ||
handleMessage: function(e) { | handleMessage: function(e) { | ||
e.channelID == This is the topic that is being observed | |||
e.version == This is the current version for this topic | |||
} | } | ||
}); | }); | ||
// to unregister, you simply call.. | // to unregister, you simply call.. |