summaryrefslogtreecommitdiffstats
path: root/extra/push-examples/javascript-fetch/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'extra/push-examples/javascript-fetch/index.js')
-rw-r--r--extra/push-examples/javascript-fetch/index.js11
1 files changed, 11 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);