how to get the value returned from callback funct

  • I am using the Browser.ExecJS to get a value returned from callback but it doesn't seem to return , seems like i have to use this stackoverflow.com/questions/6847697/how-to-return-value-from-callback-function so based on the above, i have written like this,

    function getWords(fn) {

                 

                  theCall = Bridge.query('words', {n: 5});

                  var results;

           

                 theCall.done(function (response) {

                  results = JSON.stringify(response, null, 2);

                 fn(results);

                });

    };

    and from the C2 event i call and i am assigning to a global text variable,

                

                 Browser.ExecJS("getWords(function(result){

                            alert('getResults:'+result);

                          return result;

                     });")

    Basically i needed a trick to read the values from C2 eventsheet returned from a javascript callback. Any help is appreciated ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)