/*
Name: fnGetEventHandler
Function: main of this function
1.store the nature onmessage function
2.return the param by post message to main onmessage
3.reset the onmessage function
4.tell the parent msg loop task is complete
Param: null
Return: onmessage.name==fnCallBackMainGetInhouseReservationList
let objParam = {
"name": "fnCallbackGetInhouseReservationList",
"aryObjReservationList": aryObjReservationList
}
*/
function fnMainGetEventHandler()
{
window.fnOldOnmessage= window.onmessage;
window.onmessage= function(objMsg){
console.log(objMsg);
//alert(objMsg);
if( objMsg.data.strName.match("fnCallBackGetEventHandler"))
{
//alert('fnCallbackGetInhouseReservationList');
fnResetOnmessage();
//console.log("a");
objMsg.data.strName= "fnCallBackMainGetEventHandler";
objMsg.data.bIfContinue= true;
window.postMessage(objMsg.data);
}
else
window.fnOldOnmessage(objMsg);
}
fnGetEventHandler();
}
function fnResetOnmessage( )
{
window.onmessage = window.fnOldOnmessage;
window.fnOldOnmessage= null;
}
function fnGetEventHandler()
{
let xmlhttp= new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
console.log("fnGetReservationDetails: ");
console.log(xmlhttp.responseText);
//objParam.objReservationDetails= rtn.responseJSON.ResScreenData.ResRows;
//fnTasksLoop("fnGetReservationDetails",xmlhttp.responseText);
}
}
xmlhttp.open("GET","https://app9.rmscloud.cn/api/UtilitiesService/InitEventHandler"+
"?placeholder="+ Math.random());
xmlhttp.setRequestHeader('content-Type','application/json; charset=utf-8');
xmlhttp.send();
}