Answers for "polling interval javascript"

0

polling interval javascript

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)
Posted by: Guest on September-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language