当前位置:网站首页>Setinterval, setTimeout and requestanimationframe
Setinterval, setTimeout and requestanimationframe
2022-06-28 11:21:00 【InfoQ】
setTimeoutsetTimeoutEventLoopsetTimeout// Time delay 1s after , Print hello,world
setTimeout(() => {
console.log('hello,world');
}, 1000)
setIntervalsetTimeoutsetIntervalsetIntervalsetInterval(() => {
console.log('hello,world');
}, 1000)
setTimeout- According to the refresh rate of different screens , Automatically adjust the timing of executing the callback function .
- When the window is inactive ,
requestAnimationFrameWill stop executing , andsetTimeoutCan't
- It has function throttling function
var progress = 0;
var timer = null;
function render() {
progress += 1;
if (progress <= 100) {
console.log(progress);
timer = window.requestAnimationFrame(render);
} else {
cancelAnimationFrame(timer);
}
}
// First frame rendering
window.requestAnimationFrame(render);边栏推荐
- Mysql安装配置以及解决重装Mysql时忘记root password问题
- 将浏览器中的文件 url转换为File流
- 毕业了
- [monkey] Introduction to monkey test
- 第2章 还记得点、线、面吗(二)
- Mongo database
- [semidrive source code analysis] [x9 chip startup process] 32 - play module analysis - RTOS side
- 个人买场内基金选择什么证券公司开户好,更安全
- Knowing the details of redis RDB, you can step on many holes less
- mysql-. SQL file phishing Online
猜你喜欢

Oracle 日期格式化异常:无效数字

Katalon global variable is referenced in testobject

Yann Lecun's new paper: the road to building automatic agents

一套十万级TPS的IM综合消息系统的架构实践与思考

动态库(共享库)的制作和使用

How to use output in katalon

JS foundation 1-js introduction and operator

JS基础1-JS引入与运算符

智联招聘基于 Nebula Graph 的推荐实践分享

Redis6 1: what problems can be solved by the introduction of NoSQL and redis?
随机推荐
买股票在中金证券经理的开户二维码上开户安全吗?求大神赐教
100 important knowledge points that SQL must master: retrieving data
How to distinguish and define DQL, DML, DDL and DCL in SQL
[sword finger offer] 49 Ugly number
工控安全之勒索病毒篇
This Exception was thrown from a job compiled with Burst, which has limited exception support. report errors
选择哪种编程语言,会吸引优秀的人才?
How does ETF position affect spot gold price?
毕业季,给初入社会的你一些建议
BigDecimal 类的 compareTo() 和 equals()方法
Debug debugging in katalon
NFT卡牌链游系统开发dapp搭建技术详情
工作组环境下的内网渗透:一些基础打法
JS foundation 6
Redis6 1: what problems can be solved by the introduction of NoSQL and redis?
[practice] appium settings app is not running after 5000ms
SQL必需掌握的100个重要知识点:检索数据
Ruoyi integrated building block report (NICE)
还在用 SimpleDateFormat 做时间格式化?小心项目崩掉!
Xshell和Xftp使用教程