microsoft / Chakra-Samples

Repository for Chakra JavaScript engine related samples.
MIT License
216 stars 84 forks source link

JsProjectWinrtNamespace sample not working in UWP Library #89

Open priya301191 opened 5 years ago

priya301191 commented 5 years ago

I am working on UWP library(which will be used by UWP application) , where i am trying to make HTTP Request from JavaScript using "Windows.Web" namespace. Below is the sample i am trying to run: var uri = new Windows.Foundation.Uri("http://google.com"); var httpClient = new Windows.Web.Http.HttpClient();

httpClient.getStringAsync(uri).done(function () { // do something with the string content " Debug.writeln("finished"); }, onError); function onError(reason) { // error handling Debug.writeln( "onError"); }

But this script is not working properly. After making Async call, I am not able to do anything with the response. Do I need to do something else to make this async call work, such as using "JsSetProjectionEnqueueCallback" ? But as per the documentation, for UWP apps, its not required to setup "JsSetProjectionEnqueueCallback".

Can someone please help with the sample code as well in C#?