0

In the abstract below, I'm using an SDK which has one SendRequests class which returns the retrieved objects to a callback method.

    getThumbnail : function(imageId){
            var request = new SDK.ImageRequest();
            request.ImageId = imageId;

            SDK.SendRequests([request], callback);
    }

But, what if I don't want to use a callback method and instead want to be able to return the value directly to the caller? For example:

    var thumbnail = model.getThumbnail(12345);

Thanks!

4

1 回答 1

0

这就是javascript的本质。你可以包装它并返回一个承诺。

于 2013-07-22T18:56:48.043 回答