Git Product home page Git Product logo

Comments (3)

marcuswestin avatar marcuswestin commented on September 22, 2024

Hi Murli,

Since "return" is synchronous and communication with objc is asynchronous you will not able to use "return" to give back a value from objc. You will have to use a callback function.

Cheers!
Marcus

-- while mobile

On Dec 24, 2012, at 3:34 AM, muralikrish [email protected] wrote:

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


Reply to this email directly or view it on GitHub.

from webviewjavascriptbridge.

muralikrish avatar muralikrish commented on September 22, 2024

Hi Marcus,

Thank you very much for your answer.

from webviewjavascriptbridge.

marcuswestin avatar marcuswestin commented on September 22, 2024

Yup yup! Happy to help.

Cheers!
Marcus

from webviewjavascriptbridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.