
var SAMPLE_RATE = 3000; // 3 secondsvar lastSample = Date.Now();function sample() { if (Date.Now() - lastSample >= SAMPLE_RATE * 2) { // Code here will only run if the timer is delayed by more 2X the sample rate // (e.g. if the laptop sleeps for more than 3-6 seconds) } lastSample = Date.Now(); setTimeout(sample,SAMPLE_RATE);}sample();@H_502_7@ 总结 以上是内存溢出为你收集整理的html – 当PC从睡眠模式唤醒时开始调用js函数全部内容,希望文章能够帮你解决html – 当PC从睡眠模式唤醒时开始调用js函数所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)