refactor: 改善剪贴板监听性能 修复大图卡顿与CPU高占用的问题

This commit is contained in:
ZiuChen
2022-09-17 22:39:56 +08:00
parent ba841b67a8
commit f78b87783b
11 changed files with 70 additions and 50 deletions

View File

@@ -1,2 +0,0 @@
// time.worker.js author: inu1255
const apis={sleep(ms){return new Promise(resolve=>setTimeout(resolve,ms))}};onmessage=event=>{const data=event.data;if(!data)return;const{cb,method,args}=data;if(!apis[method]){postMessage({cb:cb,err:"no such method"});return}apis[method].apply(null,args).then(res=>postMessage({cb:cb,data:res}),err=>postMessage({cb:cb,err:err}))};