Skip to content

Commit

Permalink
Fix set interval docs (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-oloughlin authored Aug 10, 2024
1 parent 4f665db commit aad9ab6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1106,15 +1106,15 @@ before the first delivery.
// Will repeat indefinitely with 1 second interval
db.setInterval(() => console.log("Hello World!"), 1_000)

// First callback starts after a 10 second delay, after that there is a random delay between 0 and 5 seconds
// First callback starts after a 10 second delay, after that there is a random interval between 0 and 5 seconds
db.setInterval(
() => console.log("I terminate after running 10 times"),
() => Math.random() * 5_000,
{
// Delay before the first callback is invoked
startDelay: 10_000,

// Count starts at 0, exitOn is run before the current callback
// Count starts at 0 and is given before the current callback is run
while: ({ count }) => count < 10,
},
)
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@olli/kvdex",
"version": "2.0.1",
"version": "2.0.2",
"exports": {
".": "./mod.ts",
"./zod": "./ext/zod.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/kvdex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export class Kvdex<const TSchema extends Schema<SchemaDefinition>> {
*
* @example
* ```ts
* // First callback starts after a 10 second delay, after that there is a random delay between 0 and 5 seconds
* // First callback starts after a 10 second delay, after that there is a random interval between 0 and 5 seconds
* db.setInterval(() => console.log("I terminate after the 10th run"), () => Math.random() * 5_000, {
* // 10 second delay before the first job callback invoked
* startDelay: 10_000,
Expand Down

0 comments on commit aad9ab6

Please sign in to comment.