we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "polling interval javascript"
Enola
07 Aug 2016
1var sleep = time => new Promise(resolve => setTimeout(resolve, time))
2var poll = (promiseFn, time) => promiseFn().then(
3             sleep(time).then(() => poll(promiseFn, time)))
4
5// Greet the World every second
6poll(() => new Promise(() => console.log('Hello World!')), 1000)
7