API Reference - WebPortal.onCurrentNotificationReceived
WebPortal.onCurrentNotificationReceived
Event triggered when a notification is received.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
window.addEventListener("message", function(event){
if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
var data = event.data;
var type = event.data.type;
switch(type){
//When a notification is pushed to the application
case "WebPortal.onCurrentNotificationReceived":
if (typeof data.value !== 'undefined'){
console.log("Notification received",data.value);
if (typeof data.value === 'object'){
alert("Notification received: "+JSON.stringify(data.value));
} else {
alert("Notification received: "+data.value);
}
}
break;
}
}
});