一种js异步处理方式
2024-09-18 09:05:20
<!DOCTYPE html>
<html lang="en"> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head> <body>
<script>
(function () {
let ctnTimer;
function a() {
let urls = [{
file: "a"
}]
setTimeout(()=>{
urls.forEach(item=>{
item.js = "1111";
})
},500)
b()
function b() {
if (urls.some(function (url) {
return !url.js;
})) {
if (!ctnTimer) clearTimeout(ctnTimer);
ctnTimer = setTimeout(b, 500);
return;
} else {
console.log("1111111");
c();
}
}
}
function c(){
console.log("32222222222")
} a();
})()
</script>
</body> </html>
最新文章
- Ural 1010. Discrete Function
- from collections import OrderedDict
- jquery&#39;中的匿名函数
- C#读写者线程(用AutoResetEvent实现同步)(转载)
- python 版本升级(CentOS) 从2.6.6升级到2.7.6
- Android自动化压力测试之Monkey Test (三)
- ios球体弹跳游戏源码
- lex&;yacc2
- android学习日记03--常用控件progressbar/seekbar
- WebService 学习过程
- 最好的程序员都是行动派(成功者不是那些明知赚钱之法还要推三阻四的人。成功者知道轻重缓急,善于把握今天) good
- Android笔记(一):从this关键字发散
- jQuery Lint: enables you to automatically inject jQuery Lint into the page as it is loaded (great for ad-hoc code validation)
- 详解Linux进程(作业)的查看和杀死
- JDBC访问及操作SQLite数据库
- [Swift]LeetCode217. 存在重复元素 | Contains Duplicate
- python 对象转字典
- MySQL CPU 使用率高的原因和解决方法
- (最短路 Floyd diskstra prim)Frogger --POJ--2253
- @Schedul 中cron的命名规则
热门文章
- Linux命令详解-ls
- PhpStorm怎么用,PhpStorm常用快捷键教程
- mysql数据库(一):建表与新增数据
- Go-gin CORS 跨域中间件
- lambda表达式----使用
- Kestrel 服务器部署多站点问题 (nginx 反向代理)
- WCF基础:绑定(二)
- dubbo-monitor安装、 监控中心 配置过程
- ng 双向数据绑定 实现 注册协议效果
- RAD Studio Mobile Roadmap updated,XE5 will released on next month, Andriod will be supported.