这个密码就是照你说的做,我走了
/* Put Your DOM update code here*/
在这里可以放置dom操作代码。
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// This looks weird because jQuery does not like async code in document ready.
$(() => { (async () => {
let getData = async () => {
console.log('getData');
let response = await fetch(
"https://d2nzqyyfd6k6c7.cloudfront.net/nova-player-history/nova969-current.json"
)
let json = await response.json()
let tDiff = json.finish - Math.round((new Date()).getTime() / 1000);
console.log(json)
console.log(`Refresh in ${tDiff}s`)
/* Put Your DOM update code here*/
await sleep(tDiff * 1000)
}
// Run It forever
for (;;) await getData()
})()});