📅  最后修改于: 2022-03-11 15:02:22.490000             🧑  作者: Mango
var sleep = time => new Promise(resolve => setTimeout(resolve, time))
var poll = (promiseFn, time) => promiseFn().then(
sleep(time).then(() => poll(promiseFn, time)))
// Greet the World every second
poll(() => new Promise(() => console.log('Hello World!')), 1000)