defer

creates a new instance of a deferred object (a promise)

object defer();
objecta 'promise' object

Example

function getData(url){
    //create deferred promise
    var promise = webix.promise.defer();
 
    webix.ajax().get(url).then(function(res){
       //resolve deferred promise
       promise.resolve(res);
    });
 
    return promise;
}
 
getData(url).then(function(data){
    //some actions with data
});

Back to top