WebAPI/SimplePush: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 87: Line 87:
// you simply call push.register
// you simply call push.register
navigator.pushNotifications.register();
navigator.pushNotifications.register();
// success callback
navigator.onregistered = function(e) {
  // post to application server
  e.target.result.pushEndpoint
  e.target.result.channelID
}
navigator.onerror = function(e) {
  e.type == 'registration-failed' or e.type == 'unregistration-failed'
  e.channelID set in case of unregistration
}


// to unregister, you simply call..
// to unregister, you simply call..


navigator.pushNotifications.unregister(channelID);
navigator.pushNotifications.unregister(channelID);
navigator.onunregistered = function(e) {
  // post to app-server
}
</pre>
</pre>


Confirmed users
93

edits

Navigation menu