Comunicate NativeModule with Main Class

Hi,

I create a Native Module that I use in JavaScript and I want to access to a public string that is in the MainView class from the Native Module.

Something like this:

public partial class MainView
{

public string MyString; // This is the string

      public MainView() {
        InitializeUX();
      }
}


public class MyLogModule : NativeModule
{
      public MyLogModule() 
      {
        AddMember(new NativeFunction("Log", (NativeCallback)Log));
      }

      static object Log(Context c, object[] args)
      {
        // How can I access to MyString from here???
        return null;
      }
}

Either pass it from javascript when you call Log:

Log(MyString);

but then the value must be visible from javascript. Or you have to register the string or MainView with MyLogModule, like you would in regular OO-programming.

public MainView() {
    MyLogModule.registerMainview(this);
    // or
    MyLogModule.registerMyString(MyString);
}