From 1119354ec9e2aa9690ca2308bd6755bb9e51e65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cruz?= Date: Fri, 20 Dec 2024 15:51:40 +0000 Subject: [PATCH] Add `loop` return value documentation --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 1592395..659d7a0 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,18 @@ processManager.loop(async () => { }, { interval: 600 }); ``` +You can also return an object with an `interval` property to override the next interval. + +```javascript +const processManager = require('process-manager'); + +processManager.loop(async () => { + console.log(await client.getSomeInfo()); + + return { interval: 1000 }; +}, { interval: 600 }); +``` + ### on(fn) This lifecycle is used to get a function suited for using with an event emitter. It does not exit unless something goes wrong.