当前位置: 代码迷 >> 综合 >> js的简单串行加载方案
  详细解决方案

js的简单串行加载方案

热度:42   发布时间:2024-01-16 15:35:09.0
写了一个超简单的串行加载工具, 不想引入框架时, 可以试用下


(function (all) {
var callee = arguments.callee;
all.shift()(function(data) {
callee.call(null, all, data);
});
})([
function(next) {
setTimeout(function() {
document.body.innerHTML += '<li>first';

next();
}, 1000)
}, function(next) {
setTimeout(function() {
document.body.innerHTML += '<li>second';

next();
}, 2000)
}, function(next) {
setTimeout(function() {
document.body.innerHTML += '<li>third';

}, 3000)
}
]);


  相关解决方案