Quantcast
Viewing all articles
Browse latest Browse all 8068

explain concept callback function on httpclient thx

i'm new about the titanium, below is the code teach by my leader today but i got something confusion, anyone can explain and clarify what i explain, and explain more explain to me thx~ it work with HTTPClient and callback function with pass the parameter.

what is the purpose of call back?

app.js
--------------
 
 
-var callFunction = require('gallery');  
 
var function GetString(jsonString)
{
    /*
    The jsonString will be return and pass something from the callback
    */
}
 
callFunction.get(GetString);
Another js file
gallery.js
--------------
 
exports.get = getData;
 
function getData(callback)
{
    /*
    var str =JSON.parse(this.responseText);
    callback(str);
    */
}

Viewing all articles
Browse latest Browse all 8068

Trending Articles