new setMessageHandler(messageType, callback)
Status: Experimental
Add the setMessageHandler 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");
}
});