Eilon / MauiHybridWebView

MIT License
216 stars 48 forks source link

allow passing of object and null from HybridWebView.SendInvokeMessageToDotNet("CallMeFromScript", ["msg from js", 987]); #48

Closed HobDev closed 8 months ago

HobDev commented 8 months ago

I am getting a response from payment gateway which I want to send to the C# for further processing like

 var respData = eval("(" + e.data + ")");
document.getElementById("monerisResponse").innerHTML = " Response Code: " +
    respData.responseCode + " Token: " + respData.dataKey + " Bind: " + respData.bin + " Error Message: " + respData.errorMessage;  
 document.getElementById("monerisFrame").style.display = 'none';

HybridWebView.SendInvokeMessageToDotNet("CallMeFromScript", [respData.dataKey, respData.bin]);`

But the exception is thrown when any parameter is empty. For example if respData.dataKey have value than respData.errorMessage is empty. But I want to send all the values and check which values are null in the C# code. Also respData.responseCode is throwing exception which I guess is because it is an int.

HelloooJoe commented 8 months ago

Check out what https://github.com/rbrundritt/MauiHybridWebView did. You can now make HTTP style requests and await a response using a web proxy he created.

Eilon commented 8 months ago

Indeed there do seem to be some bugs with null/undefined values. Fix coming soon.