Skip to content

Commit

Permalink
Add loop return value documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
satazor committed Dec 20, 2024
1 parent 0963529 commit f14acab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ processManager.loop(async () => {
}, { interval: 600 });
```

You can also return an object with `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.
Expand Down

0 comments on commit f14acab

Please sign in to comment.