mirror of
https://github.com/lrsjng/h5ai.git
synced 2024-09-20 12:48:55 -04:00
Switch to deffered objects interface.
This commit is contained in:
parent
71d2ff10dc
commit
5fab8e1465
4 changed files with 26 additions and 25 deletions
|
@ -38,8 +38,10 @@ modulejs.define('core/resource', ['_', '$', 'config', 'core/settings'], function
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: scriptsHref + filename,
|
url: scriptsHref + filename,
|
||||||
dataType: 'script',
|
dataType: 'script'
|
||||||
complete: function () { callback(); }
|
}).done(function () {
|
||||||
|
|
||||||
|
callback();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,15 @@ modulejs.define('core/server', ['$', '_', 'config', 'core/location'], function (
|
||||||
url: location.getAbsHref(),
|
url: location.getAbsHref(),
|
||||||
data: data,
|
data: data,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json'
|
||||||
success: function (json) {
|
})
|
||||||
|
.done(function (json) {
|
||||||
|
|
||||||
callback(json);
|
callback(json);
|
||||||
},
|
})
|
||||||
error: function () {
|
.fail(function () {
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
|
|
@ -50,16 +50,16 @@ modulejs.define('ext/preview-txt', ['_', '$', 'markdown', 'core/settings', 'core
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: absHref,
|
url: absHref,
|
||||||
dataType: 'text',
|
dataType: 'text'
|
||||||
success: function (content) {
|
})
|
||||||
|
.done(function (content) {
|
||||||
|
|
||||||
callback(content);
|
callback(content);
|
||||||
// setTimeout(function () { callback(content); }, 1000); // for testing
|
// setTimeout(function () { callback(content); }, 1000); // for testing
|
||||||
},
|
})
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
.fail(function (jqXHR, textStatus, errorThrown) {
|
||||||
|
|
||||||
callback('[ajax error] ' + textStatus);
|
callback('[ajax error] ' + textStatus);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -51,12 +51,11 @@ if (window.attachEvent && !window.addEventListener) { throw 'no-browser'; }
|
||||||
url: url,
|
url: url,
|
||||||
data: {action: 'get', setup: true, options: true, types: true, theme: true, langs: true},
|
data: {action: 'get', setup: true, options: true, types: true, theme: true, langs: true},
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json'
|
||||||
success: function (config) {
|
}).done(function (config) {
|
||||||
|
|
||||||
modulejs.define('config', config);
|
modulejs.define('config', config);
|
||||||
$(function () { modulejs.require(module); });
|
$(function () { modulejs.require(module); });
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in a new issue