Switch to deffered objects interface.

This commit is contained in:
Lars Jung 2014-06-21 15:28:04 +02:00
parent 71d2ff10dc
commit 5fab8e1465
4 changed files with 26 additions and 25 deletions

View file

@ -49,18 +49,18 @@ modulejs.define('ext/preview-txt', ['_', '$', 'markdown', 'core/settings', 'core
preloadText = function (absHref, callback) {
$.ajax({
url: absHref,
dataType: 'text',
success: function (content) {
url: absHref,
dataType: 'text'
})
.done(function (content) {
callback(content);
// setTimeout(function () { callback(content); }, 1000); // for testing
},
error: function (jqXHR, textStatus, errorThrown) {
})
.fail(function (jqXHR, textStatus, errorThrown) {
callback('[ajax error] ' + textStatus);
}
});
});
},
onEnter = function (items, idx) {