forked from msavin/SteveJobs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ Steve Jobs is an all inclusive package for scheduling background jobs. It automa | |
- [Jobs.configure](#jobsconfigure) | ||
- [Jobs.register](#jobsregister) | ||
- [Jobs.run](#jobsrun) | ||
- [Jobs.find](#jobsfind) | ||
- [Jobs.execute](#jobsexecute) | ||
- [Jobs.reschedule](#jobsreschedule) | ||
- [Jobs.replicate](#jobsreplicate) | ||
|
@@ -164,6 +165,30 @@ The configuration object supports the following inputs: | |
- **`callback`** - Function | ||
- Run a callback function after scheduling the job | ||
|
||
### Jobs.find | ||
|
||
`Jobs.find` allows you to find a single pending job by its arguments, and run logic against it. You can pass in a callback in the end to check for the document, and you can run the same operations with-in the function scope as you would with `Jobs.register`, as well as `this.run` as a shortcut to `Jobs.run`. | ||
|
||
```javascript | ||
Jobs.find("sendReminder", "[email protected]", "The future is here!", function (jobDoc) { | ||
if (jobDoc) { | ||
this.reschedule({ | ||
in: { | ||
minutes: 5 | ||
} | ||
}); | ||
|
||
return jobDoc; | ||
} else { | ||
this.run({ | ||
in: { | ||
minutes: 5 | ||
} | ||
}) | ||
} | ||
}); | ||
``` | ||
|
||
### Jobs.execute | ||
|
||
`Jobs.execute` allows you to run a job ahead of its due date. It can only work on jobs that have not been resolved. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters