当前位置:网站首页>web Worker 轮询请求
web Worker 轮询请求
2022-06-28 15:05:00 【Feng、锋】
// this.timer.terminate(); 关闭worker
timerWorker() {
console.log("timerWorker");
function createWorker(f) {
let blob = new Blob(["(" + f.toString() + ")()"]);
let url = window.URL.createObjectURL(blob);
let worker = new Worker(url);
return worker;
}
this.timer = createWorker(() => {
setInterval(() => {
self.postMessage("timer");
}, 1000);
});
this.timer.onmessage = () => {
// 轮询
};
this.timer.postMessage("init");
},
边栏推荐
- 美国乔布斯,殁了;中国乔布斯,卖了
- 华为能成“口红一哥”,或者“带货女王”吗?
- sent2vec教程
- 兼顾企业抗疫和发展的5个解决方案,来自IBM
- code snippet
- [C language] how to implement plural types
- Oracle11g数据库使用expdp每周进行数据备份并上传到备份服务器
- WSUS客户端访问服务端异常报错-0x8024401f「建议收藏」
- BatchNorm2d原理、作用及其pytorch中BatchNorm2d函数的参数讲解
- R语言ggplot2可视化:patchwork包将一个ggplot2可视化结果和一个plot函数可视化结果横向组合起来形成最终结果图、两个可视化的组合结果对齐、并为组合图像的每个子图添加标题
猜你喜欢
DBMS in Oracle_ output. put_ Line output problem solving process

Kwai investment e-commerce service provider Yixin optimization

Ding! Techo day Tencent technology open day arrived as scheduled!

Introduction to common components of IOT low code platform

Youju new material rushes to Shenzhen Stock Exchange: it plans to raise 650million yuan, with an annual revenue of 333million yuan

Softing epGate PB系列网关-可将PROFIBUS总线集成到EtherNet/IP网络

猫狗图像数据集上的深度学习模型性能对比
![[C language] implementation of binary tree and three Traversals](/img/9f/384a73fb82265a76fc5eef884ce279.png)
[C language] implementation of binary tree and three Traversals
Yiwen teaches you to quickly generate MySQL database diagram

Construction and management practice of ByteDance buried point data flow
随机推荐
Q-Tester 3.2:适用于开发、生产和售后的诊断测试软件
Does Frankfurt currently support SQL?
美国乔布斯,殁了;中国乔布斯,卖了
新零售线下店逆势起飞,通膨乌云下的消费热情
老板嘱咐了三遍:低调、低调、低调
Calculator (force buckle)
Leetcode 48. Rotate image (yes, resolved)
Leetcode (88) -- merge two ordered arrays
PostgreSQL实现按年、月、日、周、时、分、秒的分组统计
Send2vec tutorial
R语言ggplot2可视化:使用patchwork包(直接使用加号+)将两个ggplot2可视化结果横向组合起来形成单个可视化结果图
Softing epGate PB系列网关-可将PROFIBUS总线集成到EtherNet/IP网络
Is PMP really useful?
Performance comparison of deep learning models on cat and dog image data sets
完整的模型训练套路(一)
[JS] Fibonacci sequence implementation (recursion and loop)
Classmate Zhang hasn't learned to be an anchor yet
QQ被盗号后群发黄图,大批用户“社死”
Which is safer, a securities company or a bank? How to open an account is the safest
[spatial & single cellomics] phase 1: Study on PDAC tumor microenvironment by single cell binding spatial transcriptome