diff options
Diffstat (limited to 'extra/push-examples/javascript-fetch')
-rw-r--r-- | extra/push-examples/javascript-fetch/index.js | 11 | ||||
-rw-r--r-- | extra/push-examples/javascript-fetch/package.json | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/extra/push-examples/javascript-fetch/index.js b/extra/push-examples/javascript-fetch/index.js new file mode 100644 index 0000000..9d21d0d --- /dev/null +++ b/extra/push-examples/javascript-fetch/index.js @@ -0,0 +1,11 @@ +// Supports: Node.js >= 18, Deno, Bun +const pushURL = "https://example.com/api/push/key?status=up&msg=OK&ping="; +const interval = 60; + +const push = async () => { + await fetch(pushURL); + console.log("Pushed!"); +}; + +push(); +setInterval(push, interval * 1000); diff --git a/extra/push-examples/javascript-fetch/package.json b/extra/push-examples/javascript-fetch/package.json new file mode 100644 index 0000000..78aefc2 --- /dev/null +++ b/extra/push-examples/javascript-fetch/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "start": "node index.js" + } +} |