angularjs - JavaScript behavior and code check -


I created it.

Summary This code is:

  var myObj = function () {returns {getThis: function (callback) {return callback ("this"); }}} Var myDidSome = function () {return {doSome: function (text) {return text + "cool"; }}; }; Var subObj = function (objG, didSome) {var txt = objG.getThis (function (text) {return didSome.DoSome (text);}); Console.log (txt); } New sub-oz (new mine oz, new maided mon);  

To decode this code, see myObj and myDidSome as services ( angular ones ). I am most interested in myObj.getThis , it is going to erase some of the $ http feedback, so when this is my callback function to $ Http passing through parameters obtained from .

What I'm thinking about is $ Http is async . In my txt property subOj ( think of as an administrator ) class is correctly populated when the data comes back, So I think it should be undefined by this?

In my scenario it is completely synchronous, which clearly works

So, I would like to know whether async will be an issue here?