about summary refs log tree commit diff stats
path: root/src/sleep.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/sleep.ts')
-rw-r--r--src/sleep.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sleep.ts b/src/sleep.ts
new file mode 100644
index 0000000..94d7547
--- /dev/null
+++ b/src/sleep.ts
@@ -0,0 +1,8 @@
+let sleepTimeout: Timer;
+
+export function keepAwake() {
+  if (sleepTimeout) clearTimeout(sleepTimeout);
+  sleepTimeout = setTimeout(function () {
+    process.exit(0);
+  }, 60_000);
+}