所以我正在制作一个音乐程序,需要多个javascript元素与另一个同步.我一直在使用setInterval,它最初工作得非常好但是随着时间的推移,元素逐渐变得不同步,而音乐程序则很糟糕.
我在网上看到setTimeout更准确,你可以用某种方式设置setTimeout循环但是我还没有找到一个通用版本来说明这是如何实现的.有人可以向我展示一个使用setTimeout无限循环的基本示例.
谢谢.或者,如果有办法通过setInterval或其他功能实现更多同步结果,请告诉我.
编辑:
基本上我有一些像这样的功能:
//drums
setInterval(function {
//code for the drums playing goes here
},8000);
//chords
setInterval(function {
//code for the chords playing goes here
},1000);
//bass
setInterval(function {
//code for the bass playing goes here
},500);
Run Code Online (Sandbox Code Playgroud)
它最初工作得非常好,但是在大约一分钟的过程中,声音明显不同步,因为我已经阅读了setInterval,我读过setTimeout可以更加一致地准确.
需要发送标头以通过安全性以使用 wkhtmltopdf 截取页面屏幕截图。我需要发送一个如下所示的标头:
"Authorization=Basic " + some base 64 set of characters.
Run Code Online (Sandbox Code Playgroud)
由于某种原因,我所做的一切都不起作用......我已经尝试过
--custom-header "Authorization" "Basic ectectect"
--custom-header "Authorization"="Basic ectectect"
--custom-header "Authorization=Basic ectectect"
Run Code Online (Sandbox Code Playgroud)
一些帮助将不胜感激......文档不是很好。
command-line ×1
http-headers ×1
javascript ×1
pdf ×1
setinterval ×1
settimeout ×1
timing ×1
wkhtmltopdf ×1