This should be a simple one.
I have a function that is called and I need to wait for all the async operations to complete.
what I want is something like this...
self.processSchema(data).done(function(results){ //do stuff});
The processSchema function loops using $.each and calls an async method.
var processSchema = function(data)
{
var def = new $.Deferred();
$.each(table, function()
{
//calls an async SQLitePlugin method
db.executeSql(sql, data, function(tx, results){
def.resolve(results);
}
}
return(def.promise());
}
This does not seem to work, I am new to $.Deferred so any guidance would be helpful
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…