Start a new topic

How do i use calljavascript in Xamarin.forms context?

Im trying to call a function in my javascript code and i found you need to you the calljavascript() method. However i have no clue how to implement this in my code. Are there any examples?

1 Comment

Hi Simon,

calling the ArchitectView.callJavaScript function will simply execute whatever string you pass as JavaScript in your AR world.

Here's an example of that:


var World = {
    myFunction: function(myParameter) {
        alert("myFunction " + myParameter);


int myInputParameter = 2;
callJavaScript("World.myFunction(" + myInputParameter + ");");

This will invoke the anonymous function behind the myFunction field from native code and create an alert saying "myFunction 2". I'm not perfectly sure this is syntactically correct C#, but you get the idea.

- Daniel

Login or Signup to post a comment