new mozSetMessageHandler(messageType, callback)
Status: Experimental
Add the setMessageHandler/mozSetMessageHandler function to the global navigator object
Parameters:
Name | Type | Description |
---|---|---|
messageType |
String | a name or category to give the messages being received and in this implementation, likely 'push' |
callback |
Function | the function to be called when a message of this type is received |
Example
navigator.setMessageHandler( "push", function( message ) {
if ( message.channelID === mailEndpoint.channelID ) {
console.log("Mail Message Received");
}
});
or
// Mozilla's spec currently has the 'moz' prefix
navigator.mozSetMessageHandler( "push", function( message ) {
if ( message.channelID === mailEndpoint.channelID ) {
console.log("Mail Message Received");
}
});