edge icon indicating copy to clipboard operation
edge copied to clipboard

Can I call an internal JS method without declaring by a callback? Just return parent JS object with methods?

Open bimonsubio1984 opened this issue 6 years ago • 1 comments

Public Class FreenomDNS
      Public UserName, Password As String
      Public EdgeFunc As System.Func(Of Object, System.Threading.Tasks.Task(Of Object))
      Public Freenom As Object

      Public Function Authorize(UserName As String, Password As String)
          EdgeFunc = EdgeJs.Edge.Func("
                  var Freenom;
/*
                  ReturnValueFunc=function()
                  {
                      return Freenom;
                  }
*/
                  EdgeFunc=function (data, callback) 
                  { 
                      var UserName=data[0];
                      var Password=data[1];
                      Freenom = require(""freenom-dns"").init(UserName, Password);
                      callback(null, Freenom); 
                  };
                  return EdgeFunc;
          ")
          Freenom = EdgeFunc({UserName, Password}).WaitResult().dns
      End Function

      Function ListRecords(ForDomain As String)
          Dim FreenomFunc As System.Func(Of Object, System.Threading.Tasks.Task(Of Object)) =
                 Freenom.listRecords 'listDomains
          ListRecords = FreenomFunc(ForDomain).WaitResult(5000)
      End Function
  End Class

  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
      Dim TestDNS As New FreenomDNS
      TestDNS.Authorize(UserNameConst, PasswordConst)
      Debug.Print(TestDNS.ListRecords(DomainNameConst).ToString())

bimonsubio1984 avatar Nov 02 '18 12:11 bimonsubio1984

It hangs on line: ListRecords = FreenomFunc(ForDomain).WaitResult(5000)

Please let me know, how can I fix the problem?

bimonsubio1984 avatar Nov 02 '18 12:11 bimonsubio1984