Skip to content

Issue in returning value within a js function #31

Closed
muralikrish opened this Issue Dec 24, 2012 · 3 comments

2 participants

@muralikrish

Hi
I have been struggling with an issue for the past few days.The issue is
We have a html page which communicates wih th javascript file teh javascript file in turn communicates with the native ios code of the app using your webview javascript bridge.The problem is
in the following js function we are calling a function of another javascript file

            TheApp.getAppVersion = function()
            {
              var vpbVersion = VestaPhoneBridge.GetUserAgent().version;
              if(vpbVersion != null)
                 {
                   return ""+vpbVersion;
                 }
               return null;
            };

The above method is calling a function in another .js file which is as follows:

   VestaPhoneBridge.GetUserAgent = function(_callback)
    {
       bridge.callHandler('initiateGetUserAgentFunc','test', function(response) 
          {
             //getting response here from native 
           })
   };

The problem is in the function "bridge.callHandler('initiateGetUserAgentFunc','test', function(response) " inside the above function
we are needed to return a value but we need to return the value to VestaPhoneBridge.GetUserAgent instead of "bridge.callHandler('initiateGetUserAgentFunc','test', function(response)"
The problem is we cannot use callback function in js also.The only thing is we have to return a value.
So it would be really great if you could suggest some solution for this problem.

Thanks
Murli Krishna .V

@marcuswestin
Owner
@muralikrish

Hi Marcus,

Thank you very much for your answer.

@marcuswestin
Owner

Yup yup! Happy to help.

Cheers!
Marcus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.