<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
</style>
</head>
<body>
test
</body>
<script type="text/javascript">
var timeout1;
var count = 0;
testTimeout();
function testTimeout(){
timeout1 = setTimeout(function(){
console.log('setTimeout:' + new Date());
}, 5000);
}
var timer2 = setInterval(function(){
clearTimeout(timeout1);
console.log('clearTimeout:' + new Date());
testTimeout();
if(++count >= 3){
console.log(count);
clearInterval(timer2);
}
}, 2000);
</script>
</html>
透传消息堆积一种处理方案demo
最新推荐文章于 2024-05-31 05:32:36 发布