Created
November 10, 2020 12:40
-
-
Save brayn003/cf969125b854ff35dffae9bcff490743 to your computer and use it in GitHub Desktop.
One liner code to ping a URL every 3 secs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const URL = 'https://google.com'; | |
const main = () => fetch(URL).then(r => r.status === 200 ? console.log('IS UP', r) : console.log('down', setTimeout(main, 3000)) ).catch(() => setTimeout(main, 3000)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment